diff options
author | Larisse Voufo <lvoufo@google.com> | 2013-08-22 01:05:27 +0000 |
---|---|---|
committer | Larisse Voufo <lvoufo@google.com> | 2013-08-22 01:05:27 +0000 |
commit | 8122b22adcac608f7fb63f244f267bc22040ca80 (patch) | |
tree | 017a46dc6817ec2ca486ef386996031cc4434852 /clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp | |
parent | 72caf2bb6bae001319d1b0d924821442d13bf541 (diff) | |
download | bcm5719-llvm-8122b22adcac608f7fb63f244f267bc22040ca80.tar.gz bcm5719-llvm-8122b22adcac608f7fb63f244f267bc22040ca80.zip |
Add a constexpr functionality test for static data member templates.
llvm-svn: 188975
Diffstat (limited to 'clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp')
-rw-r--r-- | clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp b/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp index c7053549235..1505481912f 100644 --- a/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp +++ b/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp @@ -124,6 +124,25 @@ namespace non_const_init { } } +#ifndef PRECXX11 +namespace constexpred { + class A { + template<typename T> constexpr T wrong; // expected-error {{member 'wrong' declared as a template}} \ + // expected-error {{non-static data member cannot be constexpr; did you intend to make it const?}} + template<typename T> constexpr T wrong_init = 5; // expected-error {{non-static data member cannot be constexpr; did you intend to make it static?}} + template<typename T, typename T0> static constexpr T right = T(100); + template<typename T> static constexpr T right<T,int> = 5; + 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>; // expected-error {{template specialization requires 'template<>'}} \ + // expected-error {{explicit specialization of 'right' in class scope}} + }; +} +#endif + struct matrix_constants { // TODO: (?) }; |