ipa-cp: Perform operations in the appropriate types (PR 118097)
[gcc.git] / gcc / testsuite / g++.dg / cpp / embed-10.C
blob7ffcc2d2608ce56159200a474bf01852531a1974
1 // { dg-do run { target c++23 } }
2 // { dg-options "--embed-dir=${srcdir}/c-c++-common/cpp/embed-dir" }
4 const unsigned char m[] = {
5   #embed <magna-carta.txt> limit (136)
6 };
8 struct S
10   S () : a {} {};
11   template <typename ...T>
12   int &operator[] (T... args)
13   {
14     int b[] = { args... };
15     for (int i = 0; i < sizeof (b) / sizeof (b[0]); ++i)
16       if (b[i] != m[i])
17         return a[137];
18     return a[sizeof (b) / sizeof (b[0])];
19   }
20   int a[138];
23 S s;
25 int
26 main ()
28   if (&s[
29       #embed <magna-carta.txt> limit (1)
30         ] != &s.a[1])
31     __builtin_abort ();
32   if (&s[
33       #embed <magna-carta.txt> limit (6)
34         ] != &s.a[6])
35     __builtin_abort ();
36   if (&s[
37       #embed <magna-carta.txt> limit (135)
38         ] != &s.a[135])
39     __builtin_abort ();