[PATCH] D99489: [clang] [PR49736] [C++2b] Correctly reject lambdas with requires clause and no parameter list

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 29 13:25:04 PDT 2021


aaron.ballman added a comment.

Mostly looks good, just a few things with the tests.



================
Comment at: clang/test/Parser/cxx-concepts-requires-clause.cpp:160-162
 #if __cplusplus <= 202002L
 // expected-warning at -2{{is a C++2b extension}}
 #endif
----------------
This warning seems less than ideal (same issue happens below).


================
Comment at: clang/test/Parser/cxx2a-template-lambdas.cpp:15
+#if __cplusplus <= 202002L
+// expected-warning at -2 {{is a C++2b extension}}
+#endif
----------------
You should spell out the full diagnostic the first time it's used in a file.


================
Comment at: clang/test/Parser/cxx2a-template-lambdas.cpp:17
+#endif
+auto L7 = []<auto> requires true {}; // ?
+auto L8 = []<auto> requires true noexcept {};
----------------
This seems grammatically valid to me, was there a reason for the `// ?`?


================
Comment at: clang/test/Parser/cxx2a-template-lambdas.cpp:33-36
+#if __cplusplus <= 202002L
+// expected-warning at -3 {{is a C++2b extension}}
+// expected-warning at -3 {{is a C++2b extension}}
+#endif
----------------
It seems odd to warn the user about use of an extension they're not really using, but I don't think this is strictly wrong as opposed to just not being ideal. I don't think this will be trivial to improve the behavior, so I think it's fine for the moment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99489



More information about the cfe-commits mailing list