[Issue 19506] New: mixin template should be able to inject code as well as symbols
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Dec 22 09:46:27 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19506
Issue ID: 19506
Summary: mixin template should be able to inject code as well
as symbols
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: iamthewilsonator at hotmail.com
Works
---
mixin template foo(bool b)
{
int _impl() { writeln(b); return int.init; }
int _ipml2 = _impl();
}
void main()
{
mixin foo;
}
---
doesn't
---
mixin template foo(bool b)
{
writeln(b);
}
void main()
{
mixin foo;
}
---
see https://forum.dlang.org/post/txcblywfkrhpxnsbfydk@forum.dlang.org for the
discovery of this idiom
--
More information about the Digitalmars-d-bugs
mailing list