gcc/testsuite/g++.dg/cpp0x/constexpr-delegating2.C
raw| 1 | // PR c++/51723 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | template <int... V> |
| 5 | struct A |
| 6 | { |
| 7 | static constexpr int a[sizeof...(V)] = { V... }; |
| 8 | }; |
| 9 | |
| 10 | template <int... V> constexpr int A<V...>::a[]; |
| 11 | |
| 12 | struct B |
| 13 | { |
| 14 | const int* const b; |
| 15 | |
| 16 | template <unsigned int N> |
| 17 | constexpr B(const int(&b)[N]) |
| 18 | : b(b) |
| 19 | { } |
| 20 | |
| 21 | template <int... V> |
| 22 | constexpr B(A<V...>) |
| 23 | : B(A<V...>::a) |
| 24 | { } |
| 25 | }; |
| 26 | |
| 27 | constexpr B b1 = A<10, 20, 30>::a; |
| 28 | constexpr B b2 = A<10, 20, 30>(); |