On 26 March 2018 at 14:10, Jonathan Wakely wrote: > This makes it possible to use our std::variant with Clang, as well as > some minor tweaks to avoid ADL (so the compiler doesn't waste time > looking in associated namespaces) and adjust whitespace. > > * include/std/variant (__get): Qualify calls to avoid ADL. > (__select_index): Adjust whitespace. > (variant): Add using-declaration to workaround Clang bug. > > Tested powerpc64le-linux, committed to trunk.. I'll backport to > gcc-7-branch too.
The Clang bug means that __get is ambiguous (because it thinks the friend declaration is a separate overload) so we also need this change. Tested powerpc64le-linux, committed to trunk.
commit c09f881053d98370306098b7bad5bb829255379c Author: Jonathan Wakely <jwak...@redhat.com> Date: Thu Apr 5 14:03:13 2018 +0100 Add another workaround to std::variant for Clang bug 31852 * include/std/variant (_VARIANT_RELATION_FUNCTION_TEMPLATE): Qualify __get calls to avoid ADL and avoid ambiguity due to Clang bug. diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index 028d3064272..48bec528406 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -272,8 +272,8 @@ namespace __variant constexpr bool \ __erased_##__NAME(const _Variant& __lhs, const _Variant& __rhs) \ { \ - return __get<_Np>(std::forward<_Variant>(__lhs)) \ - __OP __get<_Np>(std::forward<_Variant>(__rhs)); \ + return __variant::__get<_Np>(std::forward<_Variant>(__lhs)) \ + __OP __variant::__get<_Np>(std::forward<_Variant>(__rhs)); \ } _VARIANT_RELATION_FUNCTION_TEMPLATE(<, less)