[Issue 9130] New: Wrong codegen for comile time constructed struct
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sun Dec  9 16:21:08 PST 2012
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=9130
           Summary: Wrong codegen for comile time constructed struct
           Product: D
           Version: D2
          Platform: x86
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: samukha at voliacable.com
--- Comment #0 from Max Samukha <samukha at voliacable.com> 2012-12-09 16:21:05 PST ---
This is the minimal test case I have for now. Wrong value is generated for the
'name' member causing the following to segfault at runtime (1):
struct S
{
    void bar()
    {
    }
}
struct Meta
{
    string name;
    void construct(alias m)()
    {
        name = "bar";
    }
}   
struct Function
{
    Meta super_;
    alias super_ this;
    bool break_;
    void construct(alias f)()
    {
        super_.construct!f();                
    }
    void dynConstruct(alias f)()
    {    
        if (!break_)
        {   
            break_ = true;         
            meta!(__traits(getOverloads, S, "bar")[0]);
        }
    }
}
@property void meta(alias m)()
{
    static Function md = function()
        {                            
            Function r;
            r.construct!m();
            return r;
        }();                                                                   
    assert(md.name == "bar"); // (1)
    md.dynConstruct!m();
}
void main()
{
    meta!(S.bar);
}
-- 
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