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

            Bug ID: 37844
           Summary: clang++ does not produce error messages
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

The code is as follow:

namespace N {
 extern "C" {
 extern const int foobar;
 const int foobar = 1;
 struct S { static const int foobar; };
 const int S::foobar = 2;
 }
}
int main () { return !(N::foobar + 1 == N::S::foobar); }

clang++ accepts the code, but g++ produces error messages:

conflicting declaration of ‘const int N::S::foobar’ with ‘C’ linkage
      const int S::foobar = 2;
previous declaration with ‘C++’ linkage
      struct S { static const int foobar; };

Indeed, the code comes from a bug report of gcc
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33786). A previous version of g++
produces a different error message, but was fixed in the latest version. Martin
Sebor analyzed why the above code is ill-formed. Please check this problem.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to