]>
Commit | Line | Data |
---|---|---|
cf3cefc9 | 1 | // PR c++/77830 |
2 | // { dg-do compile { target c++14 } } | |
3 | ||
4 | template <int N> | |
5 | struct P | |
6 | { | |
7 | char arr[N][1]; | |
8 | constexpr void foo (const char *, int); | |
9 | }; | |
10 | ||
11 | template <int N> | |
12 | constexpr void | |
13 | P<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 | ||
19 | template <typename... T> | |
20 | constexpr auto | |
21 | bar (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 | ||
30 | int | |
31 | main () | |
32 | { | |
a43f2adc | 33 | constexpr auto a = bar ("", ""); // { dg-message "in .constexpr. expansion of " } |
cf3cefc9 | 34 | } |