abstract Flexible(Int) {
public function new()
this = 1;
@:to function toAny<T>():T
return null;
}
function main() {
var r:String = new Flexible();
trace(r);
}
Will generate the following C++
std::string r = _Main::Flexible_Impl_::toAny(_Main::Flexible_Impl_::_new());
Which gives a compile error: no instance of function template "_Main::Flexible_Impl_::toAny" matches the argument list.
Putting the type explicitly in the call site fixes the error, like so:
std::string r = _Main::Flexible_Impl_::toAny<std::string>(_Main::Flexible_Impl_::_new());
Building this code
Will generate the following C++
Which gives a compile error:
no instance of function template "_Main::Flexible_Impl_::toAny" matches the argument list
.Putting the type explicitly in the call site fixes the error, like so: