Fix std::byte namespace declaration

François Dumont frs.dumont@gmail.com
Thu Oct 18 20:12:00 GMT 2018


Current build of libstdc++ with --enable-symvers=gnu-versioned-namespace 
fails (at least under Linux) because of:

In file included from 
/home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/memory_resource:39,
                  from 
../../../../../git/libstdc++-v3/src/c++17/memory_resource.cc:25:
/home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/cstddef:71:59: 
error: la référence à « byte » est ambiguë
    71 |   template<> struct __byte_operand<bool> { using __type = byte; };
       | ^~~~
In file included from 
/home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                  from 
/home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/memory:62,
                  from 
/home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/memory_resource:37,
                  from 
../../../../../git/libstdc++-v3/src/c++17/memory_resource.cc:25:
/home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:395:30: 
note: les candidats sont : « enum class std::__8::byte »
   395 |   enum class byte : unsigned char;
       |                              ^~~~
In file included from 
/home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/memory_resource:39,
                  from 
../../../../../git/libstdc++-v3/src/c++17/memory_resource.cc:25:
/home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/cstddef:68:14: 
note:                      « enum class std::byte »
    68 |   enum class byte : unsigned char {};
       |              ^~~~

I think the issue if that std::byte declaration in cpp_type_traits.h has 
been done in versioned namespace, so the attached patch.

     * include/bits/cpp_type_traits.h (std::byte): Move outside versioned
     namespace.

Tested under Linux x86_64.

Ok to commit ?

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: byte.patch
Type: text/x-patch
Size: 639 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20181018/e1975be8/attachment.bin>


More information about the Libstdc++ mailing list