[PATCH] D147070: Improve requirement clause limitation on non templated function

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 28 12:42:08 PDT 2023


erichkeane added inline comments.


================
Comment at: clang/test/Parser/cxx2b-lambdas.cpp:21
 auto L12 = [] consteval {};
-auto L13 = []() requires true {};
+auto L13 = []() requires true {}; // expected-error{{non-templated function cannot have a requires clause}}
 auto L14 = []<auto> requires true() requires true {};
----------------
This still parses correctly, so I consider the error here to be 'correct' and still testing what we wanted.


================
Comment at: clang/test/SemaCXX/lambda-capture-type-deduction.cpp:52
+template<typename T>
 void test_requires() {
 
----------------
When this isn't a template, all of the requires clauses below are ill-formed.  So made this a function template that hopefully @cor3ntin agrees matches his intent when he wrote this test.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147070/new/

https://reviews.llvm.org/D147070



More information about the cfe-commits mailing list