D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2234 - __traits(allMembers) returns incorrect results for mixin and template alias members of an aggregate
Summary: __traits(allMembers) returns incorrect results for mixin and template alias m...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 All
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, spec, wrong-code
Depends on:
Blocks:
 
Reported: 2008-07-18 10:04 UTC by Max Samukha
Modified: 2014-02-15 02:44 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Max Samukha 2008-07-18 10:04:58 UTC
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]
Comment 1 Justin Whear 2010-08-13 16:06:24 UTC
Updating as this is still broken in 2.048