www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7464] New: Better Error Message When Using S.tupleof within S

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

           Summary: Better Error Message When Using S.tupleof within S
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dsimcha yahoo.com



struct S {
   static if(hasIndirections!(typeof(this))) {}
}

template hasIndirections(T)
{
   enum hasIndirections = hasIndirectionsImpl!(typeof(T.init.tupleof));
}

template hasIndirectionsImpl(T...)
{
   static if (!T.length)
   {
       enum hasIndirectionsImpl = false;
   }
   else
   {
       enum hasIndirectionsImpl = true;
   }
}

This is wrong because S isn't fully defined yet, so S.init.tupleof makes no
sense.  However, the error message is extremely obtuse:

Error: struct S no size yet for forward reference

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