https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104873
Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ppalka at gcc dot gnu.org --- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> --- Reduced testcase: template<class T> concept C = true; template<class T> requires C<T> struct S { S(...); }; template<class T> S(S<T>) -> S<S<T>>; using type = decltype(S(S<int>())); using type = S<int>; // Clang accepts, GCC demands S<S<int>> The difference is that the copy deduction candidate generated by GCC is unconstrained: template<class T> S(S<T>) -> S<T>; whereas Clang presumably attaches the constraints of the class template to the candidate: template<class T> requires C<T> S(S<T>) -> S<T>; This also occurs for guides synthesized from a constructor: template<class T> concept C = true; template<class T> requires C<T> struct S { S(); S(T); // #1 }; template<class T> S(T) -> S<S<T>>; // #2 using type = decltype(S(0)); // Clang selects guide for #1, GCC selects #2 using type = S<int>; // therefore Clang accepts, GCC demands S<S<int>> Is it true that a deduction guide inherits the constraints of the class template? It's not clear to me according to [over.match.class.deduct].