Hi Jonathan, > * include/std/variant (__overload_set): Remove. > (_Arr): New helper. > (_Build_FUN): New class template to define a single FUN overload, > with specializations to prevent unwanted conversions, as per P0608R3. > (_Build_FUNs): New class template to build an overload set of FUN. > (_FUN_type): New alias template to perform overload resolution. > (__accepted_type): Use integer_constant base for failure case. Use > _FUN_type for successful case. > (variant::__accepted_index): Use _Tp instead of _Tp&&. > (variant::variant(_Tp&&)): Likewise. > (variant::operator=(_Tp&&)): Likewise. > > Tested powerpc64le-linux, committed to trunk. [...] > diff --git a/libstdc++-v3/testsuite/20_util/variant/compile.cc > b/libstdc++-v3/testsuite/20_util/variant/compile.cc > index c6b18d08258..4560f774452 100644 > --- a/libstdc++-v3/testsuite/20_util/variant/compile.cc > +++ b/libstdc++-v3/testsuite/20_util/variant/compile.cc > @@ -142,6 +142,11 @@ void arbitrary_ctor() > static_assert(noexcept(variant<int, DefaultNoexcept>(int{}))); > static_assert(!noexcept(variant<int, Empty>(Empty{}))); > static_assert(noexcept(variant<int, DefaultNoexcept>(DefaultNoexcept{}))); > + > + // P0608R3 disallow narrowing conversions and boolean conversions > + static_assert(!is_constructible_v<variant<int>, long>); > + static_assert(!is_constructible_v<variant<bool>, int>); > + static_assert(!is_constructible_v<variant<bool>, void*>);
this test (which didn't make it into the ChangeLog, btw.) FAILs on 32-bit targets (seen on i386-pc-solaris2.11, sparc-sun-solaris.11, and x86_64-pc-linux-gnu -m32): +FAIL: 20_util/variant/compile.cc (test for excess errors) Excess errors: /vol/gcc/src/hg/trunk/local/libstdc++-v3/testsuite/20_util/variant/compile.cc:147: error: static assertion failed Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University