Debian Codegraph @

gcc/testsuite/g++.dg/ubsan/return-8d.C

raw
1 // PR c++/104642
2
3 // At -O0 and -Og we default to -funreachable-traps
4 // so the below should abort at runtime.
5
6 // { dg-do run }
7 // { dg-shouldfail { *-*-* } }
8 // { dg-additional-options "-Og" }
9
10 bool b;
11
12 int f() {
13 if (b) return 42;
14 } // { dg-warning "-Wreturn-type" }
15
16 int main() { f(); }