www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2458] New: Can't deduce sizeof inner struct inside a template mixin

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

           Summary: Can't deduce sizeof inner struct inside a template mixin
           Product: D
           Version: 2.020
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: 2korden gmail.com


The following code triggers an error:

template Foo()
{
    uint getSize()
    {
        return (*this).sizeof; // line 5
    }
}

void main()
{
    struct A1
    {
        mixin Foo!(); // line 13
    }
}

test.d(5): struct test.main.A1 no size yet for forward reference
test.d(13): mixin test.main.A1.Foo!() error instantiating


-- 
Nov 16 2008