summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-04-27 21:10:04 +0000
committerDouglas Gregor <dgregor@apple.com>2010-04-27 21:10:04 +0000
commit1524333004d85771ffeece7f896a8423bfc1dd5f (patch)
treeafb356cb8c6c003039572370dfb8aeac7a1e4549 /clang/lib/Sema/SemaExpr.cpp
parent3bca8e0f2ff33c3887ffed7fe41a04ca36c81099 (diff)
downloadbcm5719-llvm-1524333004d85771ffeece7f896a8423bfc1dd5f.tar.gz
bcm5719-llvm-1524333004d85771ffeece7f896a8423bfc1dd5f.zip
It's okay to refer to non-type template parameters anywhere they are
visible. Fixes the remaining two failures in Boost.ScopeExit. llvm-svn: 102466
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 997b8f8dcb1..89a329140fa 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -459,7 +459,10 @@ Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty, SourceLocation Loc,
}
if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
- if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(CurContext)) {
+ if (isa<NonTypeTemplateParmDecl>(VD)) {
+ // Non-type template parameters can be referenced anywhere they are
+ // visible.
+ } else if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(CurContext)) {
if (const FunctionDecl *FD = MD->getParent()->isLocalClass()) {
if (VD->hasLocalStorage() && VD->getDeclContext() != CurContext) {
Diag(Loc, diag::err_reference_to_local_var_in_enclosing_function)
OpenPOWER on IntegriCloud