[Issue 22312] New: importC: redundant typedefs are rejected

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 18 06:25:31 UTC 2021


          Issue ID: 22312
           Summary: importC: redundant typedefs are rejected
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dave287091 at gmail.com

The following trivial C code fails to compile:

// redundant.c
typedef int Integer;
typedef int Integer;

redundant.c(3): Error: alias `redundant.Integer` conflicts with alias
`redundant.Integer` at redundant.c(2)

Section 6.7.3 of C11 allows redundant typedefs to the same type.

This is problematic as at least on macOS there are types that are typedef’d
more than once in standard headers.

The following also ought to compile (but currently does not):

// redundant2.c
typedef int Integer;
typedef Integer Int;
typedef int Int;


More information about the Digitalmars-d-bugs mailing list