Summary: struct methods included in .tupleof
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Robert Clipsham <> 2011-05-23 
22:17:13 BST ---
The following code:
template canPersist(T) 
    enum canPersist = canPersist!(T, typeof(T.tupleof));

template canPersist(T, U...) 
    enum canPersist = canPersist!(T, U[0]) && canPersist!(T, U[1..$]);

template canPersist(T, U : U*)
    static assert(0, "is this a bug in dmd? methods shouldn't be in .tupleof");

void main()
    struct Test
        bool opEquals(ref const Test other) const
            return true;
    enum foo = canPersist!Test;
Fails to compile with:
prog.d(13): Error: static assert  "is this a bug in dmd? methods shouldn't be
in .tupleof"
prog.d(3):        instantiated from here: canPersist!(Test,void*)
prog.d(25):        instantiated from here: canPersist!(Test)

Adding additional methods to Test has no effect (they don't show up in
.tupleof), same goes for normal fields (providing you add template
canPersist(T, U) { enum canPersist = true; }). Iterating over
typeof(Test.tupleof) in main() does not give the void* type.

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

Reply via email to