[LLVMbugs] [Bug 4389] New: clang: wrong scoping: refuses to compile global variable name same as local variable name

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Jun 14 02:37:01 PDT 2009


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

           Summary: clang: wrong scoping: refuses to compile global variable
                    name same as local variable name
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu
            Blocks: 4068


$ clang testcase-min.i
testcase-min.i:4:12: error: redefinition of 'index' as different kind of symbol
static int index[8];
           ^
testcase-min.i:2:9: note: previous definition is here
    int index = bar();
        ^
2 diagnostics generated.


testcase-min.i:
static void foo () {
    int index = bar();
}
static int index[8];


gcc compiles this code fine, and if I move the 'static int index[8]' before
foo(), then clang compiles it as well.

Why does clang still see the definition of the local index variable at the time
the global index variable is defined?


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