[Clang] accepts ambiguous inline namespace redeclaration
Open
accepts-invalid
clang:frontend
diverges-from:edg
diverges-from:gcc
generated by fuzzer
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
The code creates an inline namespace `::X0` containing another inline namespace `::X0::X0`. Because inline namespaces inject members into the enclosing namespace for lookup, `::X0::X0` also becomes visible as `::X0` at global scope, making the later `inline namespace X0 {}` ambiguous. GCC rejects it; Clang accepts it.
Code:
```
inline namespace X0 { inline namespace X0 { } } inline namespace X0 { }
```
See Compiler Explorer: [https://godbolt.org/z/crcEhreqP](https://godbolt.org/z/crcEhreqP)
The test case was generated by a fuzzer.
Contributor guide
Assessment
This issue has not been assessed yet.