digitalmars.D.bugs - [Issue 11954] New: Function call in string mixin inside mixin template without return value mistaken as declaration
- d-bugmail puremagic.com (38/38) Jan 20 2014 https://d.puremagic.com/issues/show_bug.cgi?id=11954
- d-bugmail puremagic.com (12/12) Jan 20 2014 https://d.puremagic.com/issues/show_bug.cgi?id=11954
- d-bugmail puremagic.com (10/11) Mar 07 2014 https://d.puremagic.com/issues/show_bug.cgi?id=11954
https://d.puremagic.com/issues/show_bug.cgi?id=11954 Summary: Function call in string mixin inside mixin template without return value mistaken as declaration Product: D Version: D2 Platform: x86 OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: freund.paul lvl3.org --- Example code: mixin template CallFkt() { mixin("testFkt();"); } void testFkt() { import std.stdio : writeln; writeln("Called"); } void main() { mixin CallFkt; } Output: /d534/f170.d(2): Error: function declaration without return type. (Note that constructors are always named 'this') /d534/f170.d(2): Error: no identifier for declarator testFkt() /d534/f170.d(11): Error: mixin f170.main.CallFkt!() error instantiating Expected output: Called Description: This code works when testFkt returns a value (int for example) and the call is assigned to a variable (mixin("int i = testFkt();"); for example). -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 20 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11954 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrej.mitrovich gmail.com Resolution| |INVALID 10:38:10 PST --- Mixin templates can only contain declarations, not statements. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 20 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11954Mixin templates can only contain declarations, not statements.To be more precise, mixin("testFkt();") is parsed as MixinDeclaraton: http://dlang.org/module#MixinDeclaration and it never be parsed as the MixinStatement: http://dlang.org/statement#MixinStatement -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 07 2014