[Issue 11954] New: Function call in string mixin inside mixin template without return value mistaken as declaration
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jan 20 01:10:47 PST 2014
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 at puremagic.com
ReportedBy: freund.paul at lvl3.org
--- Comment #0 from Paul Freund <freund.paul at lvl3.org> 2014-01-20 01:10:42 PST ---
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: -------
More information about the Digitalmars-d-bugs
mailing list