www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21932] New: importC: struct 'STRUCT' conflicts with struct

https://issues.dlang.org/show_bug.cgi?id=21932

          Issue ID: 21932
           Summary: importC: struct 'STRUCT' conflicts with struct
                    'STRUCT'
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

The parser allows implicit typedefs, which is not valid C.
---
struct STRUCT { void *opaque; };
STRUCT mystruct;  // Should error.
---

Instead, it errors on the correct way to declare variables of type 'struct'.
---
struct STRUCT { void *opaque; };
struct STRUCT mystruct;  // Error
---

Same goes for enums
---
enum ENUM { ENUM_a };
enum ENUM myenum;  // Error
---

--
May 19