c++: robustify testcase [PR109752]
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / nsdmi-aggr12.C
blobfcc1f50dd810d626cc92cf80ae4e9518f248e50e
1 // PR c++/90926
2 // { dg-do run { target c++14 } }
4 #include <cassert>
6 struct A
8   char str[4] = "foo";
9   char str_array[2][4] = {"bar", "baz"};
12 struct B
14   char16_t str[10];
17 int called = 0;
18 void f(A) { called = 1;};
19 void f(B) { called = 2;};
21 int
22 main ()
24   A a;
25   a.str[0] = 'g';
26   a.str_array[0][0] = 'g';
27   a = {};
29   if (__builtin_strcmp (a.str, "foo") != 0)
30     __builtin_abort();
31   if (__builtin_strcmp (a.str_array[0], "bar") != 0)
32     __builtin_abort();
34   f({"foo"}); assert(called == 1);
35   f({u"foo"}); assert(called == 2);