PR c++/86728 - C variadic generic lambda.
[official-gcc.git] / gcc / testsuite / g++.dg / ubsan / vptr-8.C
blobcb6c6ea775b7d0f0da03dd5539997bf9ba52c84e
1 // { dg-do run }
2 // { dg-shouldfail "ubsan" }
3 // { dg-options "-fsanitize=vptr -fno-sanitize-recover=vptr" }
5 extern "C" void abort ();
7 struct S { virtual void f () {} };
8 struct T : S { ~T (); };
9 struct U : S { };
10 struct V : T, virtual U {};
12 U *up;
13 V *vp;
15 int
16 main ()
18   V v;
19   up = vp = &v;
22 T::~T ()
24   if (vp != up)
25    abort ();
28 // { dg-output "\[^\n\r]*vptr-8.C:24:\[0-9]*: runtime error: cast to virtual base of address 0x\[0-9a-fA-F]* which does not point to an object of type 'V'(\n|\r\n|\r)" }
29 // { dg-output "0x\[0-9a-fA-F]*: note: object is of type 'T'(\n|\r\n|\r)" }
30 // { dg-output "  ?.. .. .. ..  ?.. .. .. ..  ?.. .. .. .. \[^\n\r]*(\n|\r\n|\r)" }
31 // { dg-output "              ?\\^~~~~~~~~~~\[^\n\r]*(\n|\r\n|\r)" }
32 // { dg-output "              ?vptr for 'T'" }