http://d.puremagic.com/issues/show_bug.cgi?id=4617
Summary: Alias this'ed symbols cannot be passed to templates Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: rsi...@gmail.com --- Comment #0 from Shin Fujishiro <rsi...@gmail.com> 2010-08-10 22:38:03 PDT --- DMD tries to evaluate alias this'ed symbols. It causes a compile error on instantiating templates with alias this'ed symbols. -------------------- test1.d alias Test!(S.square) test; struct S { struct F { int square(int n) { return n*n; } real square(real n) { return n*n; } } F forward; alias forward this; } template Test(alias k) {} -------------------- % dmd -o- -c test1.d test1.d(1): Error: function test1.S.F.square (int n) is not callable using argument types () test1.d(1): Error: expected 1 function arguments, not 0 % _ -------------------- TemplateInstance::semanticTiargs() (or TypeQualified::resolveHelper()) resolves forwarded symbols as dotvar expressions and tries to evaluate them at compile time. Apparently, it causes the problem. The error does not occur if the symbol is forwarded directly: -------------------- test2.d alias Test!(S.square) test; struct S { struct F { int square(int n) { return n*n; } real square(real n) { return n*n; } } F forward; alias forward.square square; // okay } template Test(alias k) {} -------------------- % dmd -o- -c test2.d % _ -------------------- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------