digitalmars.D.bugs - [Issue 9977] New: Function local templates should be allowed
- d-bugmail puremagic.com (37/37) Apr 22 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9977
- d-bugmail puremagic.com (10/10) Apr 22 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9977
- d-bugmail puremagic.com (18/19) Apr 22 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9977
- d-bugmail puremagic.com (11/11) Apr 22 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9977
- d-bugmail puremagic.com (10/10) Apr 22 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9977
- d-bugmail puremagic.com (12/12) Apr 22 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9977
- d-bugmail puremagic.com (7/10) Apr 22 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9977
http://d.puremagic.com/issues/show_bug.cgi?id=9977 Summary: Function local templates should be allowed Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: k.hara.pg gmail.com Currently DMD accepts declaring template aggregates and functions inside functions. void test1() { struct S1(T) { T value; } auto func1(T)(T value) { return value; } static assert(is(S1!int == struct)); assert(func1(10) == 10); } But raw template declaration is not allowed. void test2() { template S2(T) { struct S2 { T value; } } // line 10 template func2(T) { auto func2(T value) { return value; } } // line 11 static assert(is(S2!int == struct)); assert(func2(10) == 10); } Output: test.d(10): Error: template definitions aren't allowed inside functions test.d(11): Error: template definitions aren't allowed inside functions Today, I think this is not reasonable limitation. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 22 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9977 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull https://github.com/D-Programming-Language/dmd/pull/1919 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 22 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9977 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com 03:02:03 PDT ---Today, I think this is not reasonable limitation.Yes, especially since this: auto func1(T)(T value) { return value; } really translates into this: template func1(T) { auto func1(T value) { return value; } } At least that's what I remember. Thanks for working on this. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 22 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9977 Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/707415dec87694c30a569dd1b67c496a9de7f648 fix Issue 9977 - Function local templates should be allowed https://github.com/D-Programming-Language/dmd/commit/006accc47fd0fb0a8299c258f66fdb0c505d9f16 Issue 9977 - Function local templates should be allowed -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 22 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9977 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |yebblies gmail.com Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 22 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9977 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc In the changelog this should be underlined as a significant improvement of D. It's useful for unittests, to not pollute the module scope with template names that are used only inside the unittest. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 22 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9977 10:57:37 PDT ---In the changelog this should be underlined as a significant improvement of D. It's useful for unittests, to not pollute the module scope with template names that are used only inside the unittest.Yes. I've added it to the pending pull request. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 22 2013