[clang] [Clang] Ensure the method scope at the late parsing of noexcept specifiers (PR #98023)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 8 07:02:57 PDT 2024


================
@@ -529,6 +531,15 @@ void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) {
     ExprResult NoexceptExpr;
     CachedTokens *ExceptionSpecTokens;
 
+    // Push a function scope so that tryCaptureVariable() can properly visit
+    // function scopes involving function parameters that are referenced inside
+    // the noexcept specifier e.g. through a lambda expression.
+    // Example:
+    // struct X {
+    //   void ICE(int val) noexcept(noexcept([val]{}));
+    // };
+    Sema::SynthesizedFunctionScope Scope(Actions, FunctionToPush);
+
----------------
cor3ntin wrote:

nitpick: can you move that such that it is next to the ThisScope?

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


More information about the cfe-commits mailing list