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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-01-07
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:

#include <concepts>

struct U
{
    U(U&&) = delete;
};

struct V
{
    using value_type = U;
};

template<typename Coll, typename T>
requires std::convertible_to<T, typename Coll::value_type>
void add(Coll& coll, const T& val)
{
}

int main()
{
    V v;
    U u;
    add(v, u);
}

Compiled with -std=gnu++2a gives:

prog.cc: In function 'int main()':
prog.cc:22:7: error: no matching function for call to 'U::U()'
   22 |     U u;
      |       ^
prog.cc:5:5: note: candidate: 'U::U(U&&)' (deleted)
    5 |     U(U&&) = delete;
      |     ^
prog.cc:5:5: note:   candidate expects 1 argument, 0 provided
prog.cc:3:8: note: candidate: 'constexpr U::U(const U&)' (deleted)
    3 | struct U
      |        ^
prog.cc:3:8: note:   candidate expects 1 argument, 0 provided
prog.cc:23:13: error: no matching function for call to 'add(V&, U&)'
   23 |     add(v, u);
      |             ^
prog.cc:15:6: note: candidate: 'template<class Coll, class T>  requires 
convertible_to<T, typename Coll::value_type> void add(Coll&, const T&)'
   15 | void add(Coll& coll, const T& val)
      |      ^~~
prog.cc:15:6: note:   template argument deduction/substitution failed:
prog.cc:15:6: note: constraints not satisfied
In file included from prog.cc:1:
/opt/wandbox/gcc-head/include/c++/11.0.0/concepts: In substitution of
'template<class Coll, class T>  requires  convertible_to<T, typename
Coll::value_type> void add(Coll&, const T&) [with Coll = V; T = U]':
prog.cc:23:13:   required from here
/opt/wandbox/gcc-head/include/c++/11.0.0/concepts:72:13:   required for the
satisfaction of 'convertible_to<T, typename Coll::value_type>' [with T = U;
Coll = V]
/opt/wandbox/gcc-head/include/c++/11.0.0/concepts:72:30: note: the expression
'is_convertible_v<_From, _To> [with _From = U; _To = U]' evaluated to 'false'
   72 |     concept convertible_to = is_convertible_v<_From, _To>
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to