| Issue |
63887
|
| Summary |
Errors handling extern "C" variables in unnamed namespaces post-CWG 1113
|
| Labels |
c++11,
clang:frontend,
miscompilation,
accepts-invalid,
rejects-valid
|
| Assignees |
|
| Reporter |
hubert-reinterpretcast
|
Since C++11, the following code should compile:
```cpp
namespace {
extern "C" const int x = 42; // name has internal linkage; name has no language linkage ([dcl.link]/1)
}
namespace A { extern "C" const int x = 0; }
int main(void) { return A::x; }
```
Clang complains that `x` is redefined: https://godbolt.org/z/r4bdWfnrs
Online compiler link demonstrating miscompilation with use of inline variable definitions: https://godbolt.org/z/Psx79YEKK
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs