[clang] Diagnose redeclaration with different linkage (PR #178900)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 22 23:36:35 PST 2026


================
@@ -9210,9 +9210,21 @@ bool Sema::CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous) {
     Previous.setShadowed();
 
   if (!Previous.empty()) {
-    MergeVarDecl(NewVD, Previous);
-    return true;
+  if (auto *OldDecl =
----------------
ojhunt wrote:

I think this logic probably belongs in MergeVarDecl itself

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


More information about the cfe-commits mailing list