cerisier wrote:
> > libstdc++ [declares _Dir inside its C++11 ABI
> > namespace](https://github.com/gcc-mirror/gcc/blob/releases/gcc-14.2.0/libstdc%2B%2B-v3/include/bits/fs_dir.h#L94-L98),
> > then [defines it as fs::_Dir through the std::filesystem
> > alias](https://github.com/gcc-mirror/gcc/blob/releases/gcc-14.2.0/libstdc%2B%2B-v3/src/c%2B%2B17/fs_dir.cc#L39-L45).
>
> Thank you for the pointers, but can you make a small representative example
> of what libstdc++ does, or point out to an existing test? It's not 100% clear
> what `_GLIBCXX_BEGIN_NAMESPACE_CXX11` expands into, and I don't want to spend
> too much time in GPL code chasing things down.
Re @Endilll 's initial comment,
`_GLIBCXX_BEGIN_NAMESPACE_CXX11` expands to this when the new ABI is enabled:
```
namespace __cxx11 {
```
This is roughly what things expand to in libstdc++:
```
namespace filesystem {
inline namespace __cxx11 {
struct Dir;
} // namespace __cxx11
} // namespace filesystem
namespace fs = filesystem;
struct fs::Dir {};
void use(fs::Dir *) {}
```
It declares its directory implementation inside __cxx11, then defines it
through the `fs` filesystem alias without using `__cxx11`.
However, Clang drops `__cxx11` from the generated symbol names after the
definition. Because libstdc++ includes both old and new ABI implementations in
the same library, dropping the inline namespace from symbol names makes those
symbols collide.
https://github.com/llvm/llvm-project/pull/233862
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits