https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67152
Bug ID: 67152 Summary: [concepts] bogus "partial specialization of ‘foo<T>’ after instantiation" error Product: gcc Version: c++-concepts Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: eric.niebler at gmail dot com Target Milestone: --- The error happens on constrained partial specializations of a template that has already been instantiated. But the template that got instantiated would fail the constraint anyway, so the error is complaining about nothing AFAICT. Consider: template <class T> concept bool HasType = requires { typename T::type; }; template<class T> struct trait { using type = void; }; struct has_type { using type = void; }; // Instantiation here trait<has_type>::type foo() {} // constrained version here. Type "has_type" would fail this // constraint so this partial specialization would not have been // selected. template<class T> requires !HasType<T> struct trait<T> { using type = void; }; ...yields the following: test.cpp:17:8: error: partial specialization of ‘struct trait<T>’ after instantiation of ‘struct trait<has_type>’ [-fpermissive] struct trait<T> { ^ If the partial specialization is the following instead: template<class T> struct trait<T*> { using type = void; }; then there is no error. It seems to me that for partial specializations, a constraints failure should be treated similarly to a pattern match failure WRT such errors.