Add quotes for constexpr keyword.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / pr77830.C
blob6fcb1ba8847049921e4b5184cec6c6a22d261f8e
1 // PR c++/77830
2 // { dg-do compile { target c++14 } }
4 template <int N>
5 struct P
7   char arr[N][1];
8   constexpr void foo (const char *, int);
9 };
11 template <int N>
12 constexpr void
13 P<N>::foo (const char *, int i)
15   for (auto j = 0; j < 2; ++j)
16     arr[i][j] = true;
19 template <typename... T>
20 constexpr auto
21 bar (T... a)
23   const char *s[]{a...};
24   P<sizeof...(a)> p{};
25   for (auto i = 0; i < sizeof...(a); ++i)
26     p.foo (s[i], i); // { dg-message "in .constexpr. expansion of " }
27   return p;
30 int
31 main ()
33   constexpr auto a = bar ("", "");      // { dg-error "outside the bounds of array type|in .constexpr. expansion of " }