Issue 19506 - mixin template should be able to inject code as well as symbols
Summary: mixin template should be able to inject code as well as symbols
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords: spec
Depends on:
Blocks:
 
Reported: 2018-12-22 09:46 UTC by Nicholas Wilson
Modified: 2022-12-17 10:31 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Nicholas Wilson 2018-12-22 09:46:27 UTC
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