[Issue 2234] New: __traits(allMembers) returns incorrect results for mixin and template alias members of an aggregate

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 18 08:04:59 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2234

           Summary: __traits(allMembers) returns incorrect results for mixin
                    and template alias members of an aggregate
           Product: D
           Version: 2.017
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code, spec
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: samukha at voliacable.com


1. Unnamed mixin
----
import std.stdio;

template Foo()
{
  int x;
}

struct S
{
  mixin Foo;
}

void main()
{
  writefln(__traits(allMembers, S));
}
----
Outputs [__T3FooZ] instead of the expected [x]

2. Multiple unnamed mixins
---
template Foo()
{
  int x;
}

struct S
{
  mixin Foo;
  mixin Foo;
}

void main()
{
  writefln(__traits(allMembers, S));
}
----
Outputs [__T3FooZ]. What's the expected output anyway? Could the name conflict
be detected before the conflicted name is referenced?


3. Template alias
----
import std.stdio;

template Foo()
{
  int x;
}

struct S
{
  alias Foo!() foo;
}

void main()
{
  writefln(__traits(allMembers, S));
}
----
Outputs [foo __T3FooZ] instead of the expected [foo]


-- 



More information about the Digitalmars-d-bugs mailing list