Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.bugs/900205_03.C

raw
1 // { dg-do assemble }
2 // { dg-options "-Wreturn-type -pedantic-errors" }
3 // g++ 1.36.1 bug 900205_03
4
5 // Section 6.6.3 of the cfront 2.0 Reference Manual says "A return statement
6 // without an expression can be used only in functions that do not return
7 // a value, that is, a function with the return value type void..."
8
9 // Also in 6.6.3: "Flowing off the end of a function is equivalent to a
10 // return with no value; this is illegal in a value returning function."
11
12 // In contrast to the manual, g++ does not generate ERRORs for cases of
13 // "flowing off the end" of non-void functions.
14
15 // keywords: return statements, return type, void return, implicit return
16
17
18 struct struct00 { };
19
20 int global_function_0 () {
21 } // { dg-warning "no return" }
22
23 struct00 global_function_1 () {
24 } // { dg-warning "no return" }
25
26 struct struct0 {
27
28 int struct0_member_function_0 () {
29 } // { dg-warning "no return" }
30
31 struct0 struct0_member_function_1 () {
32 } // { dg-warning "no return" }
33 };
34
35 struct struct1 {
36
37 int struct1_member_function_0 ();
38
39 struct1 struct1_member_function_1 ();
40
41 };
42
43 int struct1_member_function_0 () {
44 } // { dg-warning "no return" }
45
46 struct1 struct1::struct1_member_function_1 () {
47 } // { dg-warning "no return" }
48
49 int main () { return 0; }