[LLVMbugs] [Bug 1883] New: Overly strict error with initializer + cast

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Dec 28 12:12:00 PST 2007


http://llvm.org/bugs/show_bug.cgi?id=1883

           Summary: Overly strict error with initializer + cast
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu


Not sure if I have the right component.

Compiling the following with clang -fsyntax-only:

typedef struct Test (int a;int b;} Test;
static Test t = (Test) {0,0};

gives

inittest.c:2:24: error: initializer element is not constant
static Test t = (Test) {0,0};
                       ^~~~~

gcc -fsyntax-only accepts this code, although it does warn if -pedantic is
used, and gives exactly the same error if -std=c99 is used.  So this is
apparently valid C90 code, but not valid C99?

Also, gcc accepts this code with -std=gnu99.

Found by running clang over ffmpeg code.


-- 
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