[LLVMbugs] [Bug 24116] New: Misleading error message with conflicting extern variable declarations

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 14 03:26:11 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24116

            Bug ID: 24116
           Summary: Misleading error message with conflicting extern
                    variable declarations
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: anders.granlund.0 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Consider the following program:

  int main() {
      extern int x;
      extern double x;
  }

When compiling it, the following output is given:

  error: redefinition of 'x' with a different type: 'double' vs 'int'
      extern double x;
                    ^

  note: previous definition is here
      extern int x;
                 ^

In that message the words redefinition and definition are used. The
declarations in the body of main are not definitions, so the error message and
its note is misleading. 

Compare with gcc:

error: conflicting declaration 'double x'
     extern double x;
                   ^
note: previous declaration as 'int x'
     extern int x;
                ^

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150714/45d2b0f5/attachment.html>


More information about the llvm-bugs mailing list