https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89442
Bug ID: 89442 Summary: [concepts] missing "wrong number of template arguments" error in requires-clause Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- template<typename T, typename U> constexpr bool foo = true; template<typename T> int f(T) requires foo<T> { return 0; } int i = f(0); $ g++17 -fconcepts con.cc -c con.cc:5:12: error: cannot call function 'int f(T) requires foo<T> [with T = int]' 5 | int i = f(0); | ^ con.cc:3:26: note: constraints not satisfied 3 | template<typename T> int f(T) requires foo<T> { return 0; } | ^ con.cc:3:26: note: 'foo<T>' evaluated to false The error tells me that foo<T> evaluated to false, but it should say foo<T> is invalid and report an ill-formed constraint, as in this equivalent version: template<typename, typename> struct bar { static constexpr bool value = true; }; template<typename T> int f(T) requires bar<T>::value { return 0; } int i = f(0); This second one (correctly) says: con.cc:4:45: error: wrong number of template arguments (1, should be 2) 4 | template<typename T> int f(T) requires bar<T>::value { return 0; } | ^ con.cc:2:8: note: provided for 'template<class, class> struct bar' 2 | struct bar { static constexpr bool value = true; }; | ^~~ con.cc:6:12: error: cannot call function 'int f(T) requires <erroneous-expression> [with T = int]' 6 | int i = f(0); | ^ con.cc:4:26: note: constraints not satisfied 4 | template<typename T> int f(T) requires bar<T>::value { return 0; } | ^ con.cc:6:12: note: ill-formed constraint 6 | int i = f(0); | ^