diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-11-25 22:24:25 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-11-25 22:24:25 +0000 |
| commit | f73b282bf0391374c8dbf71d81ea5541cb3e1a74 (patch) | |
| tree | 080e5b3ffed95e73306fb450368f937abb6f4ed2 /clang/lib/Sema | |
| parent | e6929ffc21fdb77941cfa48fd3bb0f719adf76fe (diff) | |
| download | bcm5719-llvm-f73b282bf0391374c8dbf71d81ea5541cb3e1a74.tar.gz bcm5719-llvm-f73b282bf0391374c8dbf71d81ea5541cb3e1a74.zip | |
Implement the rules in C++ [basic.link] and C99 6.2.2 for computing
the linkage of a declaration. Switch the lame (and completely wrong)
NamedDecl::hasLinkage() over to using the new NamedDecl::getLinkage(),
along with the "can this declaration be a template argument?" check
that started all of this.
Fixes -fsyntax-only for PR5597.
llvm-svn: 89891
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 4efecea9351..59ff2947c14 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -2365,7 +2365,7 @@ bool Sema::CheckTemplateArgumentAddressOfObjectOrFunction(Expr *Arg, // Functions must have external linkage. if (FunctionDecl *Func = dyn_cast<FunctionDecl>(DRE->getDecl())) { - if (Func->getStorageClass() == FunctionDecl::Static) { + if (Func->getLinkage() != NamedDecl::ExternalLinkage) { Diag(Arg->getSourceRange().getBegin(), diag::err_template_arg_function_not_extern) << Func << Arg->getSourceRange(); @@ -2380,7 +2380,7 @@ bool Sema::CheckTemplateArgumentAddressOfObjectOrFunction(Expr *Arg, } if (VarDecl *Var = dyn_cast<VarDecl>(DRE->getDecl())) { - if (!Var->hasGlobalStorage()) { + if (Var->getLinkage() != NamedDecl::ExternalLinkage) { Diag(Arg->getSourceRange().getBegin(), diag::err_template_arg_object_not_extern) << Var << Arg->getSourceRange(); |

