https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91662
Bug ID: 91662 Summary: [concepts] unable to deduce placeholder type, should be accepted Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: frederik.engels24 at gmail dot com Target Milestone: --- The following should compile but doesn't on current gcc-trunk (20190902) with options: "-std=c++2a -fconcepts" godbolt: https://godbolt.org/z/3jvFqX #include <type_traits> #include <utility> template<typename T, typename U> concept same_as = std::is_same_v<T, U> && std::is_same_v<U, T>; template<typename LHS, typename RHS> concept assignable_from = requires(LHS lhs, RHS&& rhs) { { lhs = std::forward<RHS>(rhs) } -> same_as<LHS>; }; template<assignable_from<int> T> void foo(T&& t) {} int main() { int i = 0; foo(i); } with output <source>: In function 'int main()': <source>:19:10: error: cannot call function 'void foo(T&&) [with T = int&]' 19 | foo(i); | ^ <source>:14:6: note: constraints not satisfied 14 | void foo(T&& t) {} | ^~~ <source>:8:9: note: within 'template<class LHS, class RHS> concept const bool assignable_from<LHS, RHS> [with LHS = int&; RHS = int]' 8 | concept assignable_from = | ^~~~~~~~~~~~~~~ <source>:8:9: note: with 'int& lhs' <source>:8:9: note: with 'int&& rhs' <source>:8:9: note: unable to deduce placeholder type 'same_as<int&>' from 'lhs =(forward<int>)(rhs)' ASM generation compiler returned: 1 <source>: In function 'int main()': <source>:19:10: error: cannot call function 'void foo(T&&) [with T = int&]' 19 | foo(i); | ^ <source>:14:6: note: constraints not satisfied 14 | void foo(T&& t) {} | ^~~ <source>:8:9: note: within 'template<class LHS, class RHS> concept const bool assignable_from<LHS, RHS> [with LHS = int&; RHS = int]' 8 | concept assignable_from = | ^~~~~~~~~~~~~~~ <source>:8:9: note: with 'int& lhs' <source>:8:9: note: with 'int&& rhs' <source>:8:9: note: unable to deduce placeholder type 'same_as<int&>' from 'lhs =(forward<int>)(rhs)' Execution build compiler returned: 1