1 // { dg-do run } 2 // { dg-options "-fsanitize=undefined -Wno-return-type" } 3 // { dg-shouldfail "ubsan" } 4 5 struct S { S (); ~S (); }; 6 S()7S::S () {} ~S()8S::~S () {} 9 10 int foo(int x)11foo (int x) 12 { 13 S a; 14 { 15 S b; 16 if (x) 17 return 1; 18 } 19 } 20 21 int main()22main () 23 { 24 foo (0); 25 } 26 27 // { dg-output "execution reached the end of a value-returning function without returning a value" } 28