[LLVMbugs] [Bug 2050] New: incorrect "error: initializer element is not constant"

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Feb 16 04:27:03 PST 2008


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

           Summary: incorrect  "error: initializer element is not constant"
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Using clang r47211, and llvm r47211 I cannot compile the code below.
gcc and icc compile the code without errors.

$ clang -fsyntax-only testcase-min.i
testcase-min.i:10:9: error: initializer element is not constant
        {"OPEN", 1, &cdiff_cmd_open }
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 diagnostic generated.

$ gcc -Wall -c testcase-min.i
testcase-min.i:9: warning: ‘commands’ defined but not used
$ icc -w2 -c testcase-min.i
testcase-min.i(9): remark #177: variable "commands" was declared but never
referenced
  static struct cdiff_cmd commands[] = {
                          ^

$ cat testcase-min.i
struct cdiff_cmd {
          const char *name;
          unsigned short argc;
          int (*handler)();
};
static int cdiff_cmd_open() {
  return 0;
}
static struct cdiff_cmd commands[] = {
        {"OPEN", 1, &cdiff_cmd_open }
};


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