1 // { dg-options "-std=c++0x -ftrack-macro-expansion=0" } 2 3 #define SA(X) static_assert (X, #X) 4 5 struct A 6 { 7 int i; AA8 constexpr A(int _i) { i = _i; } // { dg-error "empty body|uninitialized member" } 9 }; 10 11 template <class T> 12 struct B 13 { 14 T t; BB15 constexpr B(T _t): t(_t) { } 16 }; 17 18 B<int> b(1); // { dg-message "not declared .constexpr" } 19 SA(b.t==1); // { dg-error "non-constant condition|'b'" } 20 constexpr B<int> b2(1); 21 SA(b2.t==1); 22 23 template <class T> f(T a,T b)24constexpr T f(T a, T b) 25 { 26 typedef T myT; 27 return a + b; 28 } 29 30 SA(f(1,2)==3); 31