You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We all know about this, but I really reckon it's a bug and should be fixed.
templatefun(T, U)
{
voidfun(T x, U y) {}
}
templatefun2(T)
{
voidfun2(U)(T x, U y) {}
}
templatefun3(T)
{
aliasfun3(U) = fun!(T, U);
}
voidtest()
{
fun(1, 2); // arguments are inferred
fun!int(1, 2); // T is given, but U is still inferred// fun2(1, 2); // ERROR: T is NOT inferred
fun2!int(1, 2); // T is given, and U is inferred (inference works 'through' an outer template here)// fun3!int(1, 2); // ERROR: T is given, but U is NOT inferred?// why is this different than the `fun!int` case?// if you say the inference didn't work 'through' the outer template, then how do we explain the `fun2` case?
}
I feel like all the cases shown above should work, including the commented out ones.
Especially the fun3 case; once the outer template is applied, the situation should be the same as fun!int...
Basically, as I see it now; the first case with fun feels like a hack in the language, where the hack was applied to a specific edge case, rather than this concept being implemented seamlessly.
The text was updated successfully, but these errors were encountered:
thewilsonator
changed the title
Tempalte function inside template inhibits inferring arguments when called
Template function inside template inhibits inferring arguments when called
Feb 16, 2025
We all know about this, but I really reckon it's a bug and should be fixed.
I feel like all the cases shown above should work, including the commented out ones.
Especially the
fun3
case; once the outer template is applied, the situation should be the same asfun!int
...Basically, as I see it now; the first case with
fun
feels like a hack in the language, where the hack was applied to a specific edge case, rather than this concept being implemented seamlessly.The text was updated successfully, but these errors were encountered: