This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR c++/92403


Suppress diagnostics when substituting into requires-expressions
outside of concept definitions.

This change broke one existing test, which I've updated to match the
behavior of the current patch. Specifically, it changed the case
below:

template<typename T>
constexpr bool subst = true;

template<typename U>
constexpr bool test()
{
  if constexpr (requires { requires subst<U&>; }) // error?
    return true;
  else
    return false;
}

static_assert(!test<void>());

Before, the program is ill-formed as a result of substituting void for
U. After applying, the requirement is false. If you replace the
requires-expression with a concept (either before or after the patch),
you get false. So, this seems like the right behavior.

Andrew Sutton

Attachment: 0001-Suppress-diagnostics-substituting-into-a-requires-ex.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]