111
|
1 // { dg-do run { target c++11 } }
|
|
2
|
|
3 #include <cassert>
|
|
4
|
|
5 template<bool, typename _Tp = void> struct enable_if { };
|
|
6 template<typename _Tp> struct enable_if<true, _Tp> { typedef _Tp type; };
|
|
7
|
|
8
|
|
9 template <char... c>
|
|
10 constexpr typename enable_if<sizeof...(c) == 2, int>::type operator""_t ()
|
|
11 {
|
|
12 return 2;
|
|
13 }
|
|
14
|
|
15 template <char... c>
|
|
16 constexpr typename enable_if<sizeof...(c) == 1, int>::type operator""_t ()
|
|
17 {
|
|
18 return 1;
|
|
19 }
|
|
20
|
|
21 template <char... c>
|
|
22 constexpr typename enable_if<sizeof...(c) >= 3, int>::type operator""_t ()
|
|
23 {
|
|
24 return 100;
|
|
25 }
|
|
26
|
|
27 int operator""_t (long double)
|
|
28 {
|
|
29 return 200;
|
|
30 }
|
|
31
|
|
32 int main ()
|
|
33 {
|
|
34 assert (45_t == 2);
|
|
35 assert (4_t == 1);
|
|
36 assert (100000_t == 100);
|
|
37 assert (200.0_t == 200);
|
|
38 }
|