PR c++/86728 - C variadic generic lambda.
[official-gcc.git] / gcc / testsuite / g++.dg / ubsan / pr70035.C
bloba1d3dc2ec1698a9ab0667e18571989ec35f523eb
1 // PR c++/70035
2 // { dg-do run }
3 // { dg-shouldfail "ubsan" }
4 // { dg-options "-fsanitize=vptr -fno-sanitize-recover=undefined" }
6 struct A {
7   A (int) {}
8   virtual int foo () { return 1; }
9 };
10 struct B : public A {
11   using A::foo;
12   B (int x) : A (foo (x)) {}
13   int foo (int x) { return x * 2; }
16 int
17 main ()
19   B b (20);
22 // { dg-output "\[^\n\r]*pr70035.C:12:\[0-9]*: runtime error: member call on address 0x\[0-9a-fA-F]* which does not point to an object of type 'B'(\n|\r\n|\r)" }
23 // { dg-output "0x\[0-9a-fA-F]*: note: object has invalid vptr(\n|\r\n|\r)" }
24 // { dg-output "  ?.. .. .. ..  ?.. .. .. ..  ?.. .. .. .. \[^\n\r]*(\n|\r\n|\r)" }
25 // { dg-output "              ?\\^~~~~~~~~~~\[^\n\r]*(\n|\r\n|\r)" }
26 // { dg-output "              ?invalid vptr" }