www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 184] New: Cannot forward reference typedef within struct


           Summary: Cannot forward reference typedef within struct
           Product: D
           Version: 0.160
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: minor
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: deewiant gmail.com

struct vegetarian {
        carrots areYummy;

typedef ptrdiff_t carrots;


The above code fails to compile, producing the error "size of type ptrdiff_t is
not known" twice.

Changing the typedef to an alias or placing it before the struct causes it to
compile correctly.

I can't think of a good reason for why this would be an actual limitation, so I
think it's a bug.

Jun 08 2006