[clang] [Clang] Handle sema of noexcept condition in their evaluation context. (PR #67538)

via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 27 07:50:29 PDT 2023


================
@@ -718,3 +718,8 @@ void foo() {
 void GH48527() {
   auto a = []()__attribute__((b(({ return 0; })))){}; // expected-warning {{unknown attribute 'b' ignored}}
 }
+
+void GH67492() {
+  constexpr auto test = 42;
+  auto lambda = (test, []() noexcept(true) {});
----------------
cor3ntin wrote:

Yes, that's exactly the bug. It attempt a capture because we are in the lambda (in term of declaration context/scope),
but we were in the evaluation context of the enclosing expression.

`ActOnFinishFullExpression` was called (on `true`), we were thinking that `test` was in that evaluation context, and we were attempting to mark it odr used... from within the declaration context of the lambda, it's beautiful

https://godbolt.org/z/Waosza81K

https://github.com/llvm/llvm-project/pull/67538


More information about the cfe-commits mailing list