Bug 2069 – Invalid return type for __traits(derivedMembers, ...) if there are no derived members
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2008-05-05T12:54:00Z
Last change time
2015-06-09T01:19:24Z
Keywords
wrong-code
Assigned to
nobody
Creator
samukha
Comments
Comment #0 by samukha — 2008-05-05T12:54:42Z
If the type passed to __traits(derivedMembers, ...) does not have any derived members, an array of void[0u] type is returned instead of invariant(char)[][0u];
class C
{
//int x; // uncomment to make it compile
}
static assert (is (typeof(__traits(derivedMembers, C)) : string[]));
Comment #1 by hoganmeier — 2010-02-04T19:47:19Z
This was "fixed" in r360 since derivedMembers now returns a tuple instead of an array literal.