Summary: __traits(hasMember, "<name>") does not work, if
                    template has alias param
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Tobias Pankrath <> 2011-11-08 14:29:58 
PST ---
Given this code fragment:

struct Bag(S...)
����alias S Types;

template Test(alias i, B)
����void fn() {
��������foreach(t; B.Types)
������������switch(i) {
����������������case IndexOf!(t, B.Types):
��������������������pragma(msg, __traits(allMembers, t));
��������������������pragma(msg, __traits(hasMember, t, "m"));
����������������default: {}

struct A
����int m;

void main()

����int i;
����alias Test!(i, Bag!(A)).fn func;

DMD will output:

It seems that __traits(hasMember, ..) evaluates to false, despite the fact that
the type 
does have a member "m". However if the template Test does not have an alias
parameter, everything will work just fine.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to