summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/include/clang/Basic/DiagnosticSemaKinds.td3
-rw-r--r--clang/include/clang/Sema/Sema.h1
-rw-r--r--clang/lib/Parse/ParseDecl.cpp5
-rw-r--r--clang/lib/Sema/SemaDecl.cpp15
-rw-r--r--clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp11
5 files changed, 5 insertions, 30 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index f53ca666d55..46733b08699 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -4459,9 +4459,6 @@ def ext_standalone_specifier : ExtWarn<"'%0' is not permitted on a declaration "
def err_standalone_class_nested_name_specifier : Error<
"forward declaration of %select{class|struct|interface|union|enum}0 cannot "
"have a nested name specifier">;
-def err_forward_var_nested_name_specifier : Error<
- "forward declaration of variable template%select{| partial specialization}0 cannot "
- "have a nested name specifier">;
def err_typecheck_sclass_func : Error<"illegal storage class on function">;
def err_static_block_func : Error<
"function declared in block scope cannot have 'static' storage class">;
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 5d0f0813910..b914cb2b209 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -1460,7 +1460,6 @@ public:
LookupResult &Previous);
NamedDecl* ActOnTypedefNameDecl(Scope* S, DeclContext* DC, TypedefNameDecl *D,
LookupResult &Previous, bool &Redeclaration);
- bool HandleVariableRedeclaration(Decl *D, CXXScopeSpec &SS);
NamedDecl *ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC,
TypeSourceInfo *TInfo,
LookupResult &Previous,
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 915fb607a68..a1a796de414 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -1804,11 +1804,6 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D,
ThisDecl = Actions.ActOnTemplateDeclarator(getCurScope(),
*TemplateInfo.TemplateParams,
D);
- if (Tok.is(tok::semi) &&
- Actions.HandleVariableRedeclaration(ThisDecl, D.getCXXScopeSpec())) {
- SkipUntil(tok::semi, true, true);
- return 0;
- }
if (VarTemplateDecl *VT = dyn_cast_or_null<VarTemplateDecl>(ThisDecl))
// Re-direct this decl to refer to the templated decl so that we can
// initialize it.
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index beffe414f56..4d4637fd143 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -4808,21 +4808,6 @@ static bool shouldConsiderLinkage(const FunctionDecl *FD) {
llvm_unreachable("Unexpected context");
}
-bool Sema::HandleVariableRedeclaration(Decl *D, CXXScopeSpec &SS) {
- // If this is a redeclaration of a variable template or a forward
- // declaration of a variable template partial specialization
- // with nested name specifier, complain.
-
- if (D && SS.isNotEmpty() &&
- (isa<VarTemplateDecl>(D) ||
- isa<VarTemplatePartialSpecializationDecl>(D))) {
- Diag(SS.getBeginLoc(), diag::err_forward_var_nested_name_specifier)
- << isa<VarTemplatePartialSpecializationDecl>(D) << SS.getRange();
- return true;
- }
- return false;
-}
-
NamedDecl *
Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC,
TypeSourceInfo *TInfo, LookupResult &Previous,
diff --git a/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp b/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
index c878c13906d..139dd982b3b 100644
--- a/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
+++ b/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
@@ -49,8 +49,8 @@ namespace out_of_line {
template<typename T, typename T0> static CONST T right = T(100);
template<typename T> static CONST T right<T,int> = T(5);
};
- template<typename T, typename T0> CONST T B3::right; // expected-error {{forward declaration of variable template cannot have a nested name specifier}}
- template<typename T> CONST T B3::right<T,int>; // expected-error {{forward declaration of variable template partial specialization cannot have a nested name specifier}}
+ template<typename T, typename T0> CONST T B3::right;
+ template<typename T> CONST T B3::right<T,int>;
class B4 {
template<typename T, typename T0> static CONST T right;
@@ -58,9 +58,8 @@ namespace out_of_line {
template<typename T, typename T0> static CONST T right_def = T(100);
template<typename T> static CONST T right_def<T,int>; // expected-note {{explicit instantiation refers here}}
};
- template<typename T, typename T0> CONST T B4::right; // expected-error {{forward declaration of variable template cannot have a nested name specifier}}
- template<typename T> CONST T B4::right<T,int>; // expected-error {{forward declaration of variable template partial specialization cannot have a nested name specifier}} \
- // expected-note {{explicit instantiation refers here}}
+ template<typename T, typename T0> CONST T B4::right;
+ template<typename T> CONST T B4::right<T,int>; // expected-note {{explicit instantiation refers here}}
template CONST int B4::right<int,int>; // expected-error {{explicit instantiation of undefined static data member template 'right' of class}}
template CONST int B4::right_def<int,int>; // expected-error {{explicit instantiation of undefined static data member template 'right_def' of class}}
}
@@ -245,7 +244,7 @@ namespace in_class_template {
// FIXME: These cases should be accepted.
int *use_before_definition = A<int>::x<char>;
- template<typename T> template<typename U> T A<T>::x<U>[sizeof(U)]; // expected-error {{forward declaration}}
+ template<typename T> template<typename U> T A<T>::x<U>[sizeof(U)];
static_assert(sizeof(A<int>::x<char>) == 1, ""); // expected-error {{incomplete}}
template<typename T> template<typename...U> T A<T>::y<tuple<U...> >[] = { U()... };
OpenPOWER on IntegriCloud