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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Specifically, we get a new FAIL when running the libstdc++ tests in c++2a mode:

FAIL: 21_strings/basic_string/types/1.cc (test for excess errors)

That's because the is_convertible trait instantiates the new c++2a-only
__is_nothrow_type member, which instantiates the basic_string_view<X> ctor,
which is ill-formed because X isn't equality comparable.


I think this might be a rejects-valid example:

template<typename T>
struct basic_string_view
{
  constexpr basic_string_view(T p) noexcept { (void) p.i; }
};

struct X { } x;

bool b = noexcept(basic_string_view<X>{x});


ntconv.cc: In instantiation of 'constexpr
basic_string_view<T>::basic_string_view(T) [with T = X]':
ntconv.cc:10:42:   required from here
ntconv.cc:5:56: error: 'struct X' has no member named 'i'
    5 |   constexpr basic_string_view(T p) noexcept { (void) p.i; }
      |                                                      ~~^


If I'm reading the standard correctly, the constructor's noexcept-specifier is
instantiated because it's "needed" but that should not cause the instantiation
of the function declaration.

If the constructor is not constexpr it isn't instantiated when the
noexcept-specifier is needed, which is why I think it's related to this bug.

Reply via email to