https://github.com/snarang181 created 
https://github.com/llvm/llvm-project/pull/151815

Addressing 
https://github.com/llvm/llvm-project/pull/150003#discussion_r2249169463

>From c19d6a3025be9eda7a05d0ebfc459ae82272809e Mon Sep 17 00:00:00 2001
From: Samarth Narang <snar...@umass.edu>
Date: Sat, 2 Aug 2025 08:37:06 -0400
Subject: [PATCH] Cleanup of inferred noreturn attributes in explicit
 specializations.

---
 clang/lib/Sema/SemaDecl.cpp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 20fdf2de59cb1..0cef898979951 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3269,11 +3269,8 @@ void Sema::mergeDeclAttributes(NamedDecl *New, Decl *Old,
       continue;
 
     if (isa<InferredNoReturnAttr>(I)) {
-      if (auto *FD = dyn_cast<FunctionDecl>(New)) {
-        if (FD->getTemplateSpecializationKind() == TSK_ExplicitSpecialization)
-          continue; // Don't propagate inferred noreturn attributes to explicit
-                    // specializations.
-      }
+      if (auto *FD = dyn_cast<FunctionDecl>(New); FD && 
FD->getTemplateSpecializationKind() == TSK_ExplicitSpecialization)
+        continue; // Don't propagate inferred noreturn attributes to explicit
     }
 
     if (mergeDeclAttribute(*this, New, I, LocalAMK))

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to