[Issue 7758] New: Mixin error: No size yet for forward reference
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Fri Mar 23 21:05:59 PDT 2012
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=7758
           Summary: Mixin error: No size yet for forward reference
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-03-23 21:06:20 PDT ---
string Test(alias member)() 
{
    return "";
}
struct S 
{ 
    int i; 
    mixin(Test!i());
}
void main() { }
test.d(9): Error: struct test.S no size yet for forward reference
test.d(10):        called from here: Test()
test.d(10): Error: argument to mixin must be a string, not (Test())
If I use a mixin template instead it can work:
mixin template Test(alias member)
{
    typeof(member) x;
}
struct S 
{ 
    int i; 
    mixin Test!i;
}
void main() { }
And yet if I try to use mixin() inside of a mixin template it doesn't work:
string test(alias member)() { return ""; }
mixin template Test(alias member)
{
    mixin(test!member());
}
struct S 
{ 
    int i; 
    mixin Test!i;
}
void main() { }
test.d(10): Error: struct test.S no size yet for forward reference
test.d(6):        called from here: test()
test.d(6): Error: argument to mixin must be a string, not (test())
test.d(12): Error: mixin test.S.Test!(i) error instantiating
-- 
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