https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90415

Barry Revzin <barry.revzin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |barry.revzin at gmail dot com

--- Comment #11 from Barry Revzin <barry.revzin at gmail dot com> ---
Here's an interesting reduction:

#include <type_traits>
struct any {
    any();
    any(any const&);
  template <class ValueType
            , class Tp = std::decay_t<ValueType>
            , class = std::enable_if_t<
                !std::is_same<Tp, any>::value
                && std::is_copy_constructible<Tp>::value
#ifdef LIBSTDCXX
                && std::is_constructible<Tp, ValueType>::value
#endif        
        >
    >
  any(ValueType&& value);    
};

struct X {
  X(X const&);
  X(any);
};
static_assert(std::is_copy_constructible_v<X>);


This compiles fine, fails if you add -DLIBSTDCXX. I laid it out this way
because libstdc++ has that check but libc++ doesn't. Although, this is
especially weird because in this program, there is only one instantiation of
any's constructor template and it's with ValueType=X const&, which means that
we're checking is_copy_constructible<X> && is_constructible<X, X const&>...
which should be identical and yet are somehow not.

Reply via email to