Merge from trunk
[official-gcc.git] / gcc / testsuite / g++.dg / ubsan / return-1.C
blob43791b9e33f7e6adf86b3c22371d09502af044ce
1 // { dg-do run }
2 // { dg-options "-fsanitize=return" }
3 // { dg-shouldfail "ubsan" }
5 struct S { S (); ~S (); };
7 S::S () {}
8 S::~S () {}
10 int
11 foo (int x)
13   S a;
14   {
15     S b;
16     if (x)
17       return 1;
18   }
21 int
22 main ()
24   foo (0);
27 // { dg-output "execution reached the end of a value-returning function without returning a value" }