gcc/testsuite/g++.dg/torture/pr80075.C
raw| 1 | // { dg-do compile } |
| 2 | // { dg-additional-options "-fnon-call-exceptions" } |
| 3 | |
| 4 | struct s { |
| 5 | int i; |
| 6 | }; |
| 7 | |
| 8 | extern int use_memcpy; |
| 9 | extern void my_memcpy(void*, void*, int); |
| 10 | |
| 11 | int |
| 12 | f (struct s* p) |
| 13 | { |
| 14 | struct s a; |
| 15 | |
| 16 | try |
| 17 | { |
| 18 | a = (struct s){}; |
| 19 | if (!use_memcpy) |
| 20 | *p = a; |
| 21 | else |
| 22 | my_memcpy (p, &a, sizeof (struct s)); |
| 23 | } catch (...) { |
| 24 | return 0; |
| 25 | } |
| 26 | return 1; |
| 27 | } |