Author: lvoufo
Date: Wed Aug 21 20:05:27 2013
New Revision: 188975

URL: http://llvm.org/viewvc/llvm-project?rev=188975&view=rev
Log:
Add a constexpr functionality test for static data member templates.

Modified:
    cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp

Modified: cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp?rev=188975&r1=188974&r2=188975&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp Wed Aug 21 
20:05:27 2013
@@ -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: (?)
 };


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to