digitalmars.D.bugs - [Issue 9934] New: template default argument should be semantically analysed
- d-bugmail puremagic.com (28/28) Apr 14 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9934
- d-bugmail puremagic.com (11/11) Apr 15 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9934
- d-bugmail puremagic.com (19/21) Apr 15 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9934
- d-bugmail puremagic.com (7/13) Apr 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9934
- d-bugmail puremagic.com (16/30) Apr 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9934
http://d.puremagic.com/issues/show_bug.cgi?id=9934 Summary: template default argument should be semantically analysed Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: code dawg.eu cat > bug.d << CODE template foo(T = NonExistent) { } CODE dmd -c bug ---- This currently compiles even though the default parameter can never be valid. When the default parameter is a template instance it is missing from the object file. I think we should run full semantics on the default arguments when compiling a module. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 14 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9934 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com 02:05:23 PDT --- What if the template is in a mixin template? Or would the change not affect this? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 15 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9934What if the template is in a mixin template? Or would the change not affect this?Even if the template is used for mixin, default template arguments are evaluated in declaration side. alias NonExistent = int; // [a] template foo(T = NonExistent) // [b] { pragma(msg, T); // prints 'int' } class C { alias NonExistent = string; mixin foo; } If you comment out line [a], compiler reports "Error: undefined identifier NonExistent" in line [b]. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 15 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9934 03:08:18 PDT ---Ok makes sense, I never tried it before. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------What if the template is in a mixin template? Or would the change not affect this?Even if the template is used for mixin, default template arguments are evaluated in declaration side.
Apr 16 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9934 timon.gehr gmx.ch changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |timon.gehr gmx.ch Severity|normal |enhancementcat > bug.d << CODE template foo(T = NonExistent) { } CODE dmd -c bug ---- This currently compiles even though the default parameter can never be valid. When the default parameter is a template instance it is missing from the object file. I think we should run full semantics on the default arguments when compiling a module.This is not really clear. Default parameters can depend on other template arguments. Therefore, running full semantics is not possible. You'd have to specify clearly in what cases there is an error. However, I think it is not necessarily a good idea to add non-obvious rules about validity of a template declaration. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 16 2013