Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg3.C

raw
1 // PR c++/49988
2 // { dg-do run { target c++11 } }
3
4 template<int ... I> struct X { };
5
6 struct A {
7 char data[3];
8 template<int ... I>
9 constexpr
10 A(const char (&s)[3], X<I...> x) : data{ s[I]...} { }
11 };
12 struct B {
13 A a;
14 B(const char (&s)[3]) : a{s,X<0,1,2>{}} { }
15 };
16
17 int main()
18 {
19 B b{"12"};
20 if (b.a.data[0] != '1')
21 return 1;
22 }