https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97572
Bug ID: 97572 Summary: [c++ 20] Constraining is broken Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dimitri.gorokhovik at free dot fr Target Milestone: --- The code: constexpr bool any (bool) { return true; }; template <typename T> concept Any = requires (T t) { requires any (t); }; constexpr static int f (Any auto) { return 42; }; constexpr auto q = f (false); when compiled as: g++ -std=c++20 -o bug-9.o -c bug-9.cpp produces: bug-9.cpp: In substitution of ‘template<class auto:1> requires Any<auto:1> constexpr int f(auto:1) [with auto:1 = bool]’: bug-9.cpp:5:28: required from here bug-9.cpp:3:63: error: ‘t’ is not a constant expression 3 | template <typename T> concept Any = requires (T t) { requires any (t); }; | ~~~~~~~~~^~~~~~~ bug-9.cpp:5:28: error: no matching function for call to ‘f(bool)’ 5 | constexpr auto q = f (false); | ^ bug-9.cpp:4:22: note: candidate: ‘template<class auto:1> requires Any<auto:1> constexpr int f(auto:1)’ 4 | constexpr static int f (Any auto) { return 42; }; | ^ bug-9.cpp:4:22: note: substitution of deduced template arguments resulted in errors seen above GCC version: g++ (GCC) 11.0.0 20201025 (experimental)