summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr80075.C
blob: 5bc802027c09289e4fd962a84e65b7a468ae5c82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// { dg-do compile }
// { dg-additional-options "-fnon-call-exceptions" }

struct s {
    int i;
};

extern int use_memcpy;
extern void my_memcpy(void*, void*, int);

int
f (struct s* p)
{
  struct s a;

  try
    {
      a = (struct s){};
      if (!use_memcpy)
	*p = a;
      else
	my_memcpy (p, &a, sizeof (struct s));
    } catch (...) {
	return 0;
    }
  return 1;
}