std::experimental and versioned namespace

Jonathan Wakely jwakely@redhat.com
Tue Sep 19 08:03:58 GMT 2023


On Tue, 19 Sept 2023 at 06:10, François Dumont via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> I'm running 'make check-c++' in gnu-versioned_namespace mode and among
> all the failures are those:
>
> compiler exited with status 1
> FAIL: g++.dg/contracts/contracts-access1.C   (test for excess errors)
> Excess errors:
> contracts-access1.C:(.text._ZN4Base1bEv.pre[_ZN4Base1bEv]+0x64):
> undefined reference to
> `handle_contract_violation(std::experimental::contract_violation const&)'

The <experimental/contract> header uses the versioned namespace macros
for the contract_violation type:

namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION

namespace experimental
{

But the compiler expects it to be in the std::experimental namespace.

> I still need to find out what's going wrong but I also wonder if we need
> to use the versioned namespace for things in std::experimental namespace
> ? Those are already abi unstable, no ?

Yes, we can just remove the VERSION macros from the header.



More information about the Libstdc++ mailing list