is std::declval<bool&>() = std::declval<std::nullptr_t>() well-formed?

75 Views Asked by At

here is a libstdcxx static_assert:

static_assert(!std::is_assignable<bool&, std::nullptr_t>::value, "Error");

From cppreference: is_assignable:

If the expression std::declval<T>() = std::declval<U>() is well-formed in unevaluated context, provides the member constant value equal true. Otherwise, value is false. Access checks are performed as if from a context unrelated to either type.

so, libstdcxx think it is not assignable, of course, gcc cannot pass this case

In opposite, clang can pass this case

is std::declval<bool&>() = std::declval<std::nullptr_t>() well-formed, iow, clang or gcc, who objects to the standard here?

0

There are 0 best solutions below