summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-03-16 13:36:56 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-03-16 13:36:56 +0000
commitc660c8f5d2c76fe0cb18cd027057a58e2cb5de7b (patch)
tree64ae448848a29deb18f2b52107f48812d26b66f4 /clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
parent8dcf6fa3085af833751992d1ab3ceaf8f55f8cba (diff)
downloadbcm5719-llvm-c660c8f5d2c76fe0cb18cd027057a58e2cb5de7b.tar.gz
bcm5719-llvm-c660c8f5d2c76fe0cb18cd027057a58e2cb5de7b.zip
Implement C++ DR727, which permits explicit specializations at class scope.
More generally, this permits a template to be specialized in any scope in which it could be defined, so this also supersedes DR44 and DR374 (the latter of which we previously only implemented in C++11 mode onwards due to unclarity as to whether it was a DR). llvm-svn: 327705
Diffstat (limited to 'clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp')
-rw-r--r--clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp b/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
index 66f0f10f0f3..04c4429368f 100644
--- a/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
+++ b/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
@@ -15,8 +15,8 @@ class A {
template<typename T> static CONST T right<T,int> = 5;
template<typename T> CONST int right<int,T>; // expected-error {{member 'right' declared as a template}}
template<typename T> CONST float right<float,T> = 5; // expected-error {{member 'right' declared as a template}}
- template<> static CONST int right<int,int> = 7; // expected-error {{explicit specialization of 'right' in class scope}}
- template<> static CONST float right<float,int>; // expected-error {{explicit specialization of 'right' in class scope}}
+ template<> static CONST int right<int,int> = 7;
+ template<> static CONST float right<float,int>;
template static CONST int right<int,int>; // expected-error {{expected '<' after 'template'}}
};
@@ -163,8 +163,8 @@ namespace constexpred {
template<typename T> constexpr int right<int,T>; // expected-error {{member 'right' declared as a template}} \
// expected-error {{non-static data member cannot be constexpr; did you intend to make it const?}}
template<typename T> constexpr float right<float,T> = 5; // expected-error {{non-static data member cannot be constexpr; did you intend to make it static?}}
- template<> static constexpr int right<int,int> = 7; // expected-error {{explicit specialization of 'right' in class scope}}
- template<> static constexpr float right<float,int>; // expected-error {{explicit specialization of 'right' in class scope}}
+ template<> static constexpr int right<int,int> = 7;
+ template<> static constexpr float right<float,int>; // expected-error {{requires an initializer}}
template static constexpr int right<int,int>; // expected-error {{expected '<' after 'template'}}
};
}
OpenPOWER on IntegriCloud