gcc/testsuite/g++.dg/warn/pr83045.C
raw| 1 | // PR c++/83045 |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-Wreturn-type -O2" } |
| 4 | |
| 5 | void foo (void); |
| 6 | |
| 7 | int |
| 8 | bar (int a) |
| 9 | { |
| 10 | if (a != 0) |
| 11 | foo (); |
| 12 | } /* { dg-warning "no return statement in function returning non-void" } */ |
| 13 | |
| 14 | int |
| 15 | baz (int a) |
| 16 | { |
| 17 | if (a != 0) |
| 18 | __builtin_abort (); |
| 19 | } /* { dg-warning "control reaches end of non-void function" } */ |