[clang] [Clang] fix crash with generic lambdas in function default args (PR #222987)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 23 19:04:35 PDT 2026


================
@@ -7952,13 +7948,18 @@ class Parser : public CodeCompletionHandler {
       Depth += D;
       AddedLevels += D;
     }
-    void setAddedDepth(unsigned D) {
-      Depth = Depth - AddedLevels + D;
-      AddedLevels = D;
-    }
-
     unsigned getDepth() const { return Depth; }
-    unsigned getOriginalDepth() const { return Depth - AddedLevels; }
+  };
+
+  /// Utility to re-enter a possibly-templated scope while parsing its
+  /// late-parsed components.
+  struct ReenterTemplateScopeRAII {
+    MultiParseScope Scopes;
+    TemplateParameterDepthRAII CurTemplateDepthTracker;
----------------
shafik wrote:

You should delete the copy ctor and copy assignment of `TemplateParameterDepthRAII` since it is not following the rule of three. This will make copy not work for `ReenterTemplateScopeRAII` although explicitly deleting for this struct as well might be nice.

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


More information about the cfe-commits mailing list