From: Larisse Voufo Date: Thu, 22 Aug 2013 01:05:27 +0000 (+0000) Subject: Add a constexpr functionality test for static data member templates. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b9377d373bad7a0d76924551474665cc1fa01555;p=clang Add a constexpr functionality test for static data member templates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188975 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/SemaCXX/cxx1y-variable-templates_in_class.cpp b/test/SemaCXX/cxx1y-variable-templates_in_class.cpp index c705354923..1505481912 100644 --- a/test/SemaCXX/cxx1y-variable-templates_in_class.cpp +++ b/test/SemaCXX/cxx1y-variable-templates_in_class.cpp @@ -124,6 +124,25 @@ namespace non_const_init { } } +#ifndef PRECXX11 +namespace constexpred { + class A { + template 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 constexpr T wrong_init = 5; // expected-error {{non-static data member cannot be constexpr; did you intend to make it static?}} + template static constexpr T right = T(100); + template static constexpr T right = 5; + template constexpr int right; // 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 constexpr float right = 5; // expected-error {{non-static data member cannot be constexpr; did you intend to make it static?}} + template<> static constexpr int right = 7; // expected-error {{explicit specialization of 'right' in class scope}} + template<> static constexpr float right; // expected-error {{explicit specialization of 'right' in class scope}} + template static constexpr int right; // expected-error {{template specialization requires 'template<>'}} \ + // expected-error {{explicit specialization of 'right' in class scope}} + }; +} +#endif + struct matrix_constants { // TODO: (?) };