Debian Codegraph @

gcc/testsuite/g++.dg/ubsan/pr65019.C

raw
1 // PR sanitizer/65019
2 // { dg-do compile }
3 // { dg-options "-fsanitize=alignment,object-size,vptr -std=c++11 -O2 -fcompare-debug" }
4
5 struct A { };
6 struct B { };
7 struct C final {
8 C (const A &, int);
9 static B *foo (const A &, int = 1);
10 virtual ~C ();
11 void *c;
12 };
13
14 B *
15 C::foo (const A &x, int y)
16 {
17 C *d = new C (x, y);
18 if (d->c == nullptr)
19 delete d;
20
21 return 0;
22 }
23
24 C::~C ()
25 {
26 }