[clang] [Clang][Sema] Don't treat error-recovery dependence as genuine template dependence in ActOnTag (PR #221440)

Anirudh Mathur via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 8 09:47:13 PDT 2026


================
@@ -18371,7 +18356,15 @@ Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
     if (TUK == TagUseKind::Friend || TUK == TagUseKind::Reference) {
       DC = computeDeclContext(SS, false);
       if (!DC) {
-        IsDependent = true;
+        if (SS.getScopeRep().getAsType() &&
+            !SS.getScopeRep().getAsType()->containsErrors()) {
+          // This is a genuinely dependent nested-name-specifier (e.g. it
+          // depends on an uninstantiated template parameter), not one that
+          // merely appears dependent because of an embedded error-recovery
+          // placeholder. Only in that genuine case should we defer/treat this
+          // as a dependent name for the caller to handle.
+          IsDependent = true;
----------------
AnirudhMathur12 wrote:

Made the changes you requested. 

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


More information about the cfe-commits mailing list