Bug 1499 – __trais: iterating over __traits(allMembers,...) with extern attributes does not compile
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2007-09-13T10:36:00Z
Last change time
2015-06-09T01:14:16Z
Keywords
rejects-valid
Assigned to
nobody
Creator
jascha
Comments
Comment #0 by jascha — 2007-09-13T10:36:39Z
traits.d(12): variable traits.main.m voids have no value
traits.d(12): Error: foreach: void[0u] is not an array of int
it compiles fine if "extern(Windows):" is omitted or non-extern declarations are added. in the latter case, the extern-members are not listed, though.
#line 1
import std.stdio;
interface D
{
extern(Windows):
void foo();
int foo(int);
}
void main()
{
foreach ( m; __traits(allMembers, D) )
writefln(m);
}
Comment #1 by hoganmeier — 2010-02-03T05:24:30Z
compiles with r360 now that allMembers returns a tuple rather than an array.
BUT it crashes when the compiled program is run.