[Issue 9130] Wrong codegen for compile time constructed struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 10 06:52:29 PST 2012


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


Maxim Fomin <maxim at maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim at maxim-fomin.ru


--- Comment #1 from Maxim Fomin <maxim at maxim-fomin.ru> 2012-12-10 06:52:27 PST ---
It happens because of invalid usage of traits. If spec is right, getOverloads
works with classes and even if it does work with structs, dmd complains "need
'this' for bar type void()"

struct S
{
    void bar() { }
}

void meta(alias m) ()
{
       // insert some usage of m here
       // to force dmd to reject code
}

void main()
{
    //Error: need 'this' for bar type void()
    //auto x = __traits(getOverloads, S, "bar")[0];
        //But template silently 'eats' erroneous construct
    meta!(__traits(getOverloads, S, "bar")[0]);
}

In your code if you comment out "meta!(__traits(getOverloads, S, "bar")[0]);"
everything would work fine.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list