December 17, 2012 [Issue 9169] New: semantic order difference in variable declaration | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=9169 Summary: semantic order difference in variable declaration Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: k.hara.pg@gmail.com --- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2012-12-16 23:57:34 PST --- Spin-off issue from bug 9159. Between DeclDefs and function body scopes, semantic analysis works differently for variable declaration. ---- version = A; // or B struct P { int v; this(int i) { v = i; } } P p(int i) { assert(0); return typeof(return)(i); } class C { version(A) P p = p(10); // Error: struct P does not overload () } void main() { version(B) P p = p(10); // asserts in runtime } ---- In the semantic analysis for the expression p(10), - `p` matches the declared variable itself in DeclDefs scope (version=A). - `p` matches the module level function in function scope (version=B). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 23, 2012 [Issue 9169] semantic order difference in variable declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=9169 --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-12-23 08:21:37 PST --- Related: issue 3131 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation