https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99961
Bug ID: 99961 Summary: requires clause rejects mentioning of function parameters too early Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nickgray0 at brown dot edu Target Milestone: --- the following code fails to compile: struct A { static constexpr auto x = 42; }; auto f(auto a) requires (a.x > 10) {} auto main()->int { f(A{}); } error message: <source>:5:27: error: use of parameter outside function body before '.' token 5 | auto f(auto a) requires (a.x > 10) {} | ^ <source>: In function 'int main()': <source>:8:6: error: no matching function for call to 'f(A)' 8 | f(A{}); | ~^~~~~ <source>:5:6: note: candidate: 'template<class auto:1> auto f(auto:1) requires <erroneous-expression>' 5 | auto f(auto a) requires (a.x > 10) {} | ^ <source>:5:6: note: template argument deduction/substitution failed: <source>:5:6: note: constraints not satisfied as shown in the example above, a.x doesn't *actually* make use of a