| 1 |
// { dg-do run { target c++11 } } |
| 2 |
// { dg-options "--embed-dir=${srcdir}/c-c++-common/cpp/embed-dir" } |
| 3 |
|
| 4 |
const unsigned char m[] = { |
| 5 |
#embed <magna-carta.txt> limit (131) |
| 6 |
}; |
| 7 |
|
| 8 |
template <int ...N> |
| 9 |
int |
| 10 |
foo () |
| 11 |
{ |
| 12 |
unsigned char a[] = { N... }; |
| 13 |
for (int i = 0; i < sizeof (a); ++i) |
| 14 |
if (a[i] != m[i]) |
| 15 |
return -1; |
| 16 |
return sizeof (a); |
| 17 |
} |
| 18 |
|
| 19 |
template <typename ...T> |
| 20 |
int |
| 21 |
bar (T... args) |
| 22 |
{ |
| 23 |
int a[] = { args... }; |
| 24 |
for (int i = 0; i < sizeof (a) / sizeof (a[0]); ++i) |
| 25 |
if (a[i] != m[i]) |
| 26 |
return -1; |
| 27 |
return sizeof (a) / sizeof (a[0]); |
| 28 |
} |
| 29 |
|
| 30 |
int |
| 31 |
main () |
| 32 |
{ |
| 33 |
if (foo < |
| 34 |
#embed <magna-carta.txt> limit (1) |
| 35 |
> () != 1) |
| 36 |
__builtin_abort (); |
| 37 |
if (foo < |
| 38 |
#embed <magna-carta.txt> limit (6) |
| 39 |
> () != 6) |
| 40 |
__builtin_abort (); |
| 41 |
if (foo < |
| 42 |
#embed <magna-carta.txt> limit (131) |
| 43 |
> () != 131) |
| 44 |
__builtin_abort (); |
| 45 |
if (bar ( |
| 46 |
#embed <magna-carta.txt> limit (1) |
| 47 |
) != 1) |
| 48 |
__builtin_abort (); |
| 49 |
if (bar ( |
| 50 |
#embed <magna-carta.txt> limit (6) |
| 51 |
) != 6) |
| 52 |
__builtin_abort (); |
| 53 |
if (bar ( |
| 54 |
#embed <magna-carta.txt> limit (131) |
| 55 |
) != 131) |
| 56 |
__builtin_abort (); |
| 57 |
} |