https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102412
Bug ID: 102412 Summary: Template argument deduction fails when using concept as defaulted non-type template parameter Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: joeloser93 at gmail dot com Target Milestone: --- When using a defaulted non-type template parameter whose value is from a concept, GCC is unable to deduce the template correctly when calling the function template. Clang accepts this code and it should be valid. ``` #include <concepts> template<class T, class U> concept different_from = not std::is_same_v<T, U>; template<class T, auto B = different_from<T, int>> void f() {} template<class T, auto B = not std::is_same_v<T, int>> void g() {} int main() { f<double>(); // fails to compile g<double>(); // compiles } ``` See it live at https://godbolt.org/z/n1zrzGPoq