Bug fix: disallow a variable template to be redeclared as a non-templated variable
llvm-svn: 188350
diff --git a/clang/test/CXX/temp/temp.spec/cxx1y-variable-template-no-body.cpp b/clang/test/CXX/temp/temp.spec/cxx1y-variable-template-no-body.cpp
index 4cff1e2..edaae9f 100644
--- a/clang/test/CXX/temp/temp.spec/cxx1y-variable-template-no-body.cpp
+++ b/clang/test/CXX/temp/temp.spec/cxx1y-variable-template-no-body.cpp
@@ -20,7 +20,7 @@
T pi0 = T(3.1415926535897932385); // expected-note {{previous definition is here}}
template int pi0 = 10; // expected-error {{variable cannot be defined in an explicit instantiation; if this declaration is meant to be a variable definition, remove the 'template' keyword}} \
- expected-error{{redefinition of 'pi0' with a different type: 'int' vs 'T'}}
+ expected-error{{redefinition of 'pi0' as different kind of symbol}}
#endif
template<typename T>
diff --git a/clang/test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp b/clang/test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp
index 3844ec9..d12feef 100644
--- a/clang/test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp
+++ b/clang/test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp
@@ -163,8 +163,7 @@
template<> struct X<1>::Y { static const int Z = 1; };
const int X<0>::Y::Z;
- template<> const int X<1>::Y::Z; // expected-error{{extraneous 'template<>' in declaration of variable 'Z'}} \
- // expected-error{{forward declaration of variable template cannot have a nested name specifier}}
+ template<> const int X<1>::Y::Z; // expected-error{{extraneous 'template<>' in declaration of variable 'Z'}}
}
namespace PR9913 {
diff --git a/clang/test/PCH/cxx1y-variable-templates.cpp b/clang/test/PCH/cxx1y-variable-templates.cpp
index 8bc2129..0c600b2 100644
--- a/clang/test/PCH/cxx1y-variable-templates.cpp
+++ b/clang/test/PCH/cxx1y-variable-templates.cpp
@@ -168,5 +168,4 @@
int* intpb = vd<int>;
}
-
#endif
diff --git a/clang/test/SemaCXX/cxx1y-variable-templates_top_level.cpp b/clang/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
index dc721ce1..82e3c11 100644
--- a/clang/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
+++ b/clang/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
@@ -72,7 +72,7 @@
}
namespace pvt_cv {
template<typename T> T v; // expected-note {{previous definition is here}}
- int v; // expected-error {{redefinition of 'v' with a different type: 'int' vs 'T'}}
+ int v; // expected-error {{redefinition of 'v' as different kind of symbol}}
}
namespace pvt_cvt {
template<typename T> T v0; // expected-note {{previous definition is here}}
@@ -107,6 +107,9 @@
#ifdef CXX11
template<typename T> extern auto v; // expected-error {{declaration of variable 'v' with type 'auto' requires an initializer}}
#endif
+
+ template<typename T> T var = T(); // expected-note {{previous definition is here}}
+ extern int var; // expected-error {{redefinition of 'var' as different kind of symbol}}
}
#ifdef CXX11