visible. Fixes the remaining two failures in Boost.ScopeExit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102466
91177308-0d34-0410-b5e6-
96231b3b80d8
}
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)
compare_and_set2 (false, gross);
}
}
+
+namespace Templates {
+ template<int Value>
+ void f() {
+ struct Inner {
+ static int getValue() { return Value; }
+ };
+ }
+}