| 1 |
// PR c++/90926 |
| 2 |
// { dg-do run { target c++14 } } |
| 3 |
// { dg-skip-if "requires hosted libstdc++ for cassert" { ! hostedlib } } |
| 4 |
|
| 5 |
#include <cassert> |
| 6 |
|
| 7 |
struct A |
| 8 |
{ |
| 9 |
char str[4] = "foo"; |
| 10 |
char str_array[2][4] = {"bar", "baz"}; |
| 11 |
}; |
| 12 |
|
| 13 |
struct B |
| 14 |
{ |
| 15 |
char16_t str[10]; |
| 16 |
}; |
| 17 |
|
| 18 |
int called = 0; |
| 19 |
void f(A) { called = 1;}; |
| 20 |
void f(B) { called = 2;}; |
| 21 |
|
| 22 |
int |
| 23 |
main () |
| 24 |
{ |
| 25 |
A a; |
| 26 |
a.str[0] = 'g'; |
| 27 |
a.str_array[0][0] = 'g'; |
| 28 |
a = {}; |
| 29 |
|
| 30 |
if (__builtin_strcmp (a.str, "foo") != 0) |
| 31 |
__builtin_abort(); |
| 32 |
if (__builtin_strcmp (a.str_array[0], "bar") != 0) |
| 33 |
__builtin_abort(); |
| 34 |
|
| 35 |
f({"foo"}); assert(called == 1); |
| 36 |
f({u"foo"}); assert(called == 2); |
| 37 |
} |