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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-08-24
                 CC|                            |ville at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Tony E Lewis from comment #0)
> From a quick look, I can't see anything obvious in the standard about
> whether either GCC or Clang is wrong here and I guess it's arguable either
> way. But I think I'd lean towards arguing that Clang's behaviour better
> reflects what I'd expect from traits.

A handrolled trait in pure C++ without the intrinsic doesn't need to
instantiate it, so I agree the intrinsic shouldn't.

struct true_type { static constexpr bool value = true; };
struct false_type { static constexpr bool value = false; };

template<typename> struct always_false : false_type { };

template <typename T> struct x {
        operator bool() {
                static_assert( always_false<T>::value );
                return false;
        }
};

template<typename T, typename Arg>
struct is_constructible_impl
{
  template<typename U>
    static auto
    test(Arg* a) -> decltype(U(*a), void(), true_type{});

  template<typename U>
    static false_type
    test(...);

  using type = decltype(test<T>((Arg*)0));
};

template<typename T, typename Arg>
struct is_constructible : is_constructible_impl<T, Arg>::type { };

inline constexpr auto a = is_constructible<bool, x<int>>{};

Reply via email to