1 // { dg-do compile } 2 // { dg-options "-std=gnu++0x" } 3 4 template<typename _Tp, _Tp v> 5 struct A3 6 { 7 typedef _Tp value_type; 8 typedef A3<value_type,v> type; 9 10 static constexpr value_type value = v; 11 value_typeA312 constexpr operator value_type() { return value; } 13 }; 14 15 // Partial specialization. 16 template<typename _Tp, _Tp v> 17 struct A3<_Tp*, v> 18 { 19 typedef _Tp* value_type; 20 typedef A3<value_type,v> type; 21 22 static constexpr value_type value = v; 23 24 constexpr operator value_type() { return value; } 25 }; 26 27 // Explicit specialization. 28 template<> 29 struct A3<unsigned short, 0> 30 { 31 typedef unsigned short value_type; 32 typedef A3<value_type, 0> type; 33 34 static constexpr value_type value = 0; 35 36 constexpr operator value_type() { return value; } 37 }; 38 39 // Explicitly instantiate. 40 template struct A3<int, 415>; 41 42 // Extern explicitly instantiate. 43 extern template struct A3<int, 510>; 44 45 // Use. 46 A3<int, 1111> a31; 47 A3<char, 9999> a32; // { dg-warning "overflow" } 48