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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Concepts are not supposed to error out if there was an error but rather turn
into false. clang does not error out either.

GCC correctly rejects if test is defined as:
template < typename T >
constexpr bool test = std::same_as <decltype(T::func), int(int) >;

If you do:
static_assert(test<D>);

GCC will tell you know test<D> is false even:
<source>:10:15: error: static assertion failed
   10 | static_assert(test<D>);
      |               ^~~~~~~
<source>:10:15: note: constraints not satisfied
/opt/compiler-explorer/gcc-trunk-20230506/include/c++/14.0.0/concepts:57:15:  
required for the satisfaction of '__same_as<_Tp, _Up>' [with _Tp =
decltype(T::func); _Up = int(int)]
/opt/compiler-explorer/gcc-trunk-20230506/include/c++/14.0.0/concepts:62:13:  
required for the satisfaction of 'same_as<decltype (T::func), int(int)>' [with
T = D]
<source>:5:39: error: invalid use of non-static member function 'int
D::func(int)'
    5 | concept test = std::same_as <decltype(T::func), int(int) >;
      |                                       ^

concepts are supposed to be Subsitutation is not a failure proof for the reason
they are replacements for that for improved testing.

Reply via email to