Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!jarthur!uci-ics!gateway From: rfg@paris.ics.uci.edu (Ronald Guilmette) Newsgroups: comp.lang.c++ Subject: cfront 2.0 bug 900219_01 Message-ID: <25E0704E.14739@paris.ics.uci.edu> Date: 19 Feb 90 22:16:47 GMT Organization: UC Irvine Department of ICS Lines: 52 // cfront 2.0 bug 900219_01 // cfront allows functions, operators and type conversion operators to be // declared (and defined) to return array type values if a typedef name is // used as the return type designator. // cfront will issue a warning for such usage in definitions, but is totally // silent about such usage in declarations. Both definitions and declarations // should get errors. // Further, the C code generated for such usage is not accepted by at least // one ANSI C compiler (gcc). // The gcc and g++ compilers disallow functions returning arrays and issue // appropriate error messages. typedef int array_type[]; array_type global_array_object = { 1, 2, 3 }; // OK struct struct0 { }; array_type global_function (); // ERROR array_type operator ! (struct0);// ERROR array_type global_function () // ERROR - cfront gives warning only { return global_array_object; } array_type operator ! (struct0) // ERROR - cfront gives warning only { return global_array_object; } struct struct1 { array_type member_function (); // ERROR operator array_type (); // ERROR }; array_type struct1::member_function () // ERROR - cfront gives warning { return global_array_object; } struct1::operator array_type () // ERROR - cfront gives warning { return global_array_object; }; int main () { return 0; }