Bug 4844 – _traits(allMembers, X) ignores version guards inside X
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2010-09-09T08:09:00Z
Last change time
2012-12-20T13:22:58Z
Assigned to
nobody
Creator
andrei
Comments
Comment #0 by andrei — 2010-09-09T08:09:51Z
Consider:
import std.stdio;
struct A
{
version (none)
{
int x;
}
else
{
int y;
}
int z;
}
void main()
{
foreach (s; __traits(allMembers, A))
writeln(s);
}
Surprisingly, this prints
x
z
although version "none" is not defined.
Comment #1 by code — 2012-09-04T13:02:17Z
Any update on this? I just ran into the exact same issue.
Comment #2 by andrej.mitrovich — 2012-12-20T13:22:58Z