February 05, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3744


Hoenir <mrmocool@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrmocool@gmx.de


--- Comment #10 from Hoenir <mrmocool@gmx.de> 2010-02-04 20:00:15 PST ---
This is correlated with that bug: http://d.puremagic.com/issues/show_bug.cgi?id=1386

Interestingly it still doesn't work even though allMembers returns a tuple since r360:

4: foreach(m; __traits(allMembers, Check)){
5:    if (!__traits(isVirtualFunction, __traits(getMember, Check, m))){
6:        writefln("Var: s%, Type: %s", m, typeid(typeof(m)));
    }
}

yields:

main.d(5): Error: 'this' is only defined in non-static member functions, not
main
main.d(5): Error: this for a needs to be type Check not type int

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 06, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3744


Brad Roberts <braddr@puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Platform|x86_64                      |x86


--- Comment #11 from Brad Roberts <braddr@puremagic.com> 2011-02-06 15:39:45 PST ---
Mass migration of bugs marked as x86-64 to just x86.  The platform run on isn't what's relevant, it's if the app is a 32 or 64 bit app.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 30, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3744


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies@gmail.com
           Platform|x86                         |All
         Resolution|                            |FIXED
         OS/Version|Linux                       |All


--- Comment #12 from yebblies <yebblies@gmail.com> 2011-06-30 14:38:26 EST ---
(In reply to comment #10)
> Interestingly it still doesn't work even though allMembers returns a tuple since r360:
> 
> 4: foreach(m; __traits(allMembers, Check)){
> 5:    if (!__traits(isVirtualFunction, __traits(getMember, Check, m))){
> 6:        writefln("Var: s%, Type: %s", m, typeid(typeof(m)));
>     }
> }
> 
> yields:
> 
> main.d(5): Error: 'this' is only defined in non-static member functions, not
> main
> main.d(5): Error: this for a needs to be type Check not type int

It actually works correctly now (dmd 2.053).
The errors in the sample above are because it's not possible to get a member
variable of from the class type, you need an instance.

The following works:

--

import std.stdio;

class Check { void foo() {} int bar() { return 0; } invariant() {} int x; }

void main()
{
    Check check;
    foreach(m; __traits(allMembers, Check))
    {
        if (!__traits(isVirtualFunction, __traits(getMember, check, m))){
            writefln("Var: %s, Type: %s", m, typeid(typeof(m)));
        }
    }
}

--

The bug was fixed when __traits(allMembers) started returning a tuple.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
1 2
Next ›   Last »