================ @@ -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(); + } ---------------- elhewaty wrote:
@AaronBallman > If the prior declaration specifies internal or external linkage, the linkage > of the identifier at the later declaration is the same as the linkage > specified at the prior declaration. Then when should the declaration be an issue (https://godbolt.org/z/roE9xh76d)? [Note: the diagnostic of clang and GCC is different.] If the external linkage follows the previous linkage, when could the error happen? 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