digitalmars.D.bugs - [Issue 8256] New: mixin() doesn't work in a template declaration
- d-bugmail puremagic.com (18/18) Jun 16 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8256
- d-bugmail puremagic.com (17/17) Jun 17 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8256
- d-bugmail puremagic.com (6/6) Jun 17 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8256
- d-bugmail puremagic.com (7/7) Jun 17 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8256
- d-bugmail puremagic.com (6/6) Jun 17 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8256
http://d.puremagic.com/issues/show_bug.cgi?id=8256 Summary: mixin() doesn't work in a template declaration Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: wfunction hotmail.com --- Comment #0 from wfunction hotmail.com 2012-06-16 17:53:32 PDT --- string getTypeName() { return "int"; } template Foo(T = mixin(getTypeName())) { } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 16 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8256 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement --- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2012-06-17 00:22:55 PDT --- This is not allowed in current spec. http://dlang.org/expression.html#MixinExpression MixinExpression is an expression, not a type. template Foo(T = mixin(getTypeName())) { } ^ There should be a type. And the text contents of the string must be compilable as a valid AssignExpression. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 17 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8256 --- Comment #2 from wfunction hotmail.com 2012-06-17 01:37:22 PDT --- Oh hmm, I see... any chance that it might be allowed at some point? :D -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 17 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8256 --- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2012-06-17 02:05:15 PDT --- Workaround(not tested): template Foo(T = typeof(mixin(getTypeName()).init)) { } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 17 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8256 --- Comment #4 from wfunction hotmail.com 2012-06-17 02:12:42 PDT --- Oh cool, that works! Thanks! -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 17 2012