rfg@paris.ics.uci.edu (Ron Guilmette) (02/08/90)
// cfront 2.0 bug 900205.03
// Cfront's handling of functions which should return a (non-void) value
// is inconsistant.
// Section 6.6.3 of the cfront 2.0 Reference Manual says "A return statement
// without an expression can be used only in functions that do not return
// a value, that is, a function with the return value type void..."
// Also in 6.6.3: "Flowing off the end of a function is equivalent to a
// return with no value; this is illegal in a value returning function."
// In contrast to the manual, cfront itself responds as follows to various
// cases of "flowing off the end" of non-void functions.
// Global functions which are declared to return non-void and which actually
// return no value generate warnings (regardless of the declared return type).
// Member functions which are declared to return non-void and which actually
// return no value and which are defined within their associated classes
// generate either (a) warnings if the declared return type is a builtin
// type, or (b) errors if the declared type is a user-defined type.
// Member functions which are declared to return non-void and which actually
// return no value and which are defined outside of their associated classes
// generate neither errors nor warnings.
struct struct00 { };
int global_function_0 () {
} /* ERROR (gets warning) */
struct00 global_function_1 () {
} /* ERROR (gets warning) */
struct struct0 {
int struct0_member_function_0 () {
} /* ERROR (gets warning) */
struct0 struct0_member_function_1 () {
} /* ERROR (gets error) */
};
struct struct1 {
int struct1_member_function_0 ();
struct1 struct1_member_function_1 ();
};
int struct1_member_function_0 () {
} /* ERROR (missed) */
struct1 struct1::struct1_member_function_1 () {
} /* ERROR (missed) */