[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 13:07:13 PDT 2023


erichkeane added a comment.

Thanks for the double check on the review!  I'm going to wait for the libcxx bot to come back (and for it to not be a commit at end of day!), but then will commit (unless there is new info).



================
Comment at: clang/test/SemaCXX/lambda-capture-type-deduction.cpp:52
+template<typename T>
 void test_requires() {
 
----------------
cor3ntin wrote:
> erichkeane wrote:
> > 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.
> It does, thanks!
> It's weird that i didn't notice the bug when writing those tests - at the same time i always felt this restriction to be a bit artificial.
Oh, absolutely.  Some of the limitations (on function defined inside of a function template that cannot be defined) are sensible in that they are otherwise unusable.  

I suspect the reasoning is that else we have to start mangling requires clauses even on non templates, AND it makes `extern "C"` not work for functions with requires clauses.


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

https://reviews.llvm.org/D147070



More information about the cfe-commits mailing list