[LLVMbugs] [Bug 1867] New: typedef-ing the same type twice in different headers

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Dec 17 11:38:13 PST 2007


           Summary: typedef-ing the same type twice in different headers
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: parser
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu

GCC allows this, and compiles the code. Clang gives an error.
Different headers declare the same type.
GCC only allows it if the headers are different, if I remove the # 328, then I
get an error from gcc too.

As long as the types are compatible, is this a bug in the source code, or in

$ gcc -c headers.i
$ clang headers.i
headers.i:4:23: error: redefinition of 'Byte'
typedef unsigned char Byte;
headers.i:2:23: error: previous definition is here
typedef unsigned char Byte;
2 diagnostics generated.


# 13 "../../../libclamav/lzma/LzmaTypes.h"
typedef unsigned char Byte;
# 328 "/usr/include/zconf.h" 3 4
typedef unsigned char Byte;

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list