Debian Codegraph @

gcc/testsuite/g++.dg/cpp1z/inline-var10.C

raw
1 // PR c++/114013
2 // { dg-do link { target c++17 } }
3
4 struct S { int a, b; };
5
6 template <int N>
7 constexpr struct S var[8] = {};
8
9 template <>
10 constexpr inline struct S var<6>[8] = {
11 { 1, 1 }, { 2, 0 }, { 3, 1 }, { 4, 0 },
12 { 5, 1 }, { 6, 0 }, { 7, 1 }, { 8, 0 }
13 };
14
15 [[gnu::noipa]] void
16 foo (S)
17 {
18 }
19
20 template <int N>
21 void
22 bar (int x)
23 {
24 foo (var<N>[x]);
25 }
26
27 volatile int x;
28
29 int
30 main ()
31 {
32 bar <6> (x);
33 }