-
-
Notifications
You must be signed in to change notification settings - Fork 668
Open
Description
struct Test
{
void fn(int) {}
void fn()(float) {} // template overload
}
void test()
{
Test t;
void delegate(int) fnptr = &__traits(getOverloads, t, "fn", true)[0];
void delegate(float) tfnptr = &__traits(getOverloads, t, "fn", true)[1]!(); // error : semicolon needed to end declaration of `tfnptr` instead of `!`
// you can see above when we try and instantiate the template given by getOverloads, it seems the grammar just doesn't accept it!
// ...but really, the main issue leading here is another case of `alias` not working as people expect:
alias fn = __traits(getOverloads, t, "fn", true)[0]; // error : alias `fn` cannot alias an expression `t.fn`
alias tfn = __traits(getOverloads, t, "fn", true)[1]; // error : alias `tfn` cannot alias an expression `t.fn()(float)`
fnptr = &fn;
tfnptr = &tfn!();
}I think this whole block of code should compile; the template instanton issue, and also the "alias not working as expected" issue.
Metadata
Metadata
Assignees
Labels
No labels