================
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+int p(int x, int = sizeof(x));
+int q(int x, int = sizeof([] { return x; }()));
+int r(int x, int = decltype([] { return x; }())());
+int s(int x, bool = noexcept([] { return x; }()));
----------------
zwuis wrote:

1. Whether or not `[] { return x; }` appears in an unevaluated context, we 
should reject the lambda, because using `x` requires capturing it. I'm 
surprised this kind of semantic checks is skipped in default arguments.

2. Same as other lambdas not in an unevaluated context, referencing function 
parameters should be rejected.

I'm not sure how complex the root cause might be.

https://github.com/llvm/llvm-project/pull/235057
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to