]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/g++.dg/cpp1y/pr77830.C
Consolidate constexpr array handling.
[thirdparty/gcc.git] / gcc / testsuite / g++.dg / cpp1y / pr77830.C
CommitLineData
cf3cefc9 1// PR c++/77830
2// { dg-do compile { target c++14 } }
3
4template <int N>
5struct P
6{
7 char arr[N][1];
8 constexpr void foo (const char *, int);
9};
10
11template <int N>
12constexpr void
13P<N>::foo (const char *, int i)
14{
15 for (auto j = 0; j < 2; ++j)
a43f2adc 16 arr[i][j] = true; // { dg-error "outside the bounds of array type" }
cf3cefc9 17}
18
19template <typename... T>
20constexpr auto
21bar (T... a)
22{
23 const char *s[]{a...};
24 P<sizeof...(a)> p{};
25 for (auto i = 0; i < sizeof...(a); ++i)
5967b28b 26 p.foo (s[i], i); // { dg-message "in .constexpr. expansion of " }
cf3cefc9 27 return p;
28}
29
30int
31main ()
32{
a43f2adc 33 constexpr auto a = bar ("", ""); // { dg-message "in .constexpr. expansion of " }
cf3cefc9 34}