This is the mail archive of the gcc-bugs@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]

[Bug c++/67324] Failures in Assignable concept's requires-expression


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

Casey Carter <Casey at Carter dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Casey at Carter dot net

--- Comment #1 from Casey Carter <Casey at Carter dot net> ---
>  template< class T, class U = T >
>  concept bool
>    Assignable( )
>  {
>    return
>      requires( T&& a, U&& b ) {
>        //{ forward<T>(a) = forward<U>(b) } -> Same<T&>;        // #1
>        //Same<T&, decltype(forward<T>(a) = forward<U>(b))>();  // #2
>      };
>  }

#2 is an expression constraint requiring "Same<...>()" to be a valid
expression. It notably does NOT require "Same<...>()" to be satisfied. You need
a nested-requirement to express this:

template< class T, class U = T >
concept bool
  Assignable()
{
  return
    requires( T&& a, U&& b ) {
      requires Same<T&, decltype(forward<T>(a) = forward<U>(b))>();
    };
}


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