[Issue 23105] New: `__trait(getMember)` and `mixin()` of the same code as a string behaves differently
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 12 09:30:03 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23105
Issue ID: 23105
Summary: `__trait(getMember)` and `mixin()` of the same code as
a string behaves differently
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: accepts-invalid
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: b2.temp at gmx.com
```
module self;
enum getMember = `__traits(getMember, sym, m)`;
template test(alias sym)
{
static foreach (m; __traits(allMembers, sym))
{
static if (is(__traits(getMember, sym, m)==module))
static assert(0); // pass
static if (is(mixin(getMember)==module))
static assert(0); // fails
}
}
void main()
{
alias _ = test!(self);
}
```
the first static assert should fail the condition is the same as the second.
--
More information about the Digitalmars-d-bugs
mailing list