================
@@ -4754,6 +4754,11 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult 
&Previous) {
     return New->setInvalidDecl();
   }
 
+  if (Old->getFormalLinkage() != New->getFormalLinkage()) {
+    Diag(New->getLocation(), diag::err_multiple_linkage) << New->getDeclName();
+    return New->setInvalidDecl();
+  }
----------------
AaronBallman wrote:
I think http://eel.is/c++draft/dcl.stc#example-1 has a lot of good examples 
that are worth looking at.

We do a lot of this checking already, starting from 
https://github.com/llvm/llvm-project/blob/cb8d83a77c25e529f58eba17bb1ec76069a04e90/clang/lib/Sema/SemaDecl.cpp#L4643
 and the issue might relate to the FIXME at 
https://github.com/llvm/llvm-project/blob/cb8d83a77c25e529f58eba17bb1ec76069a04e90/clang/lib/Sema/SemaDecl.cpp#L4696

https://github.com/llvm/llvm-project/pull/78064
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to