From: Rafael Espindola Date: Thu, 4 Apr 2013 17:16:12 +0000 (+0000) Subject: Use isExternalLinkage instead of hasExternalLinkage. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29c41b51137b2cbc21a8c93f7c61149247c6b01a;p=clang Use isExternalLinkage instead of hasExternalLinkage. Having these not be the same makes an easy to misuse API. We should audit the uses and probably rename to something like foo->hasExternalLinkage(): The c++ standard one. That is UniqueExternalLinkage or ExternalLinkage. foo->hasUniqueExternalLinkage(): Is UniqueExternalLinkage. foo->hasCogeGenExternalLinkage(): Is ExternalLinkage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178768 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index af0b2bb72c..7a537f04e9 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2328,7 +2328,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, Scope *S) { // storage classes. if (!isa(New) && !isa(Old) && New->getStorageClass() == SC_Static && - Old->hasExternalLinkage() && + isExternalLinkage(Old->getLinkage()) && !New->getTemplateSpecializationInfo() && !canRedefineFunction(Old, getLangOpts())) { if (getLangOpts().MicrosoftExt) { diff --git a/test/SemaCXX/linkage2.cpp b/test/SemaCXX/linkage2.cpp index d1aee4e55d..8a91ca4960 100644 --- a/test/SemaCXX/linkage2.cpp +++ b/test/SemaCXX/linkage2.cpp @@ -140,3 +140,10 @@ namespace test13 { extern void a(); static void a(void) {} } + +namespace test14 { + namespace { + void a(void); // expected-note {{previous declaration is here}} + static void a(void) {} // expected-error {{static declaration of 'a' follows non-static declaration}} + } +}