FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.bugs / 900215_01.C
blob70df42670d6f46a15566c2ff272722600015d83e
1 // g++ 1.36.1 bug 900215_01
3 // g++ allows the definition of a type conversion operator `operator void'
4 // for class types, but subsequently fails to generate calls (where needed)
5 // for such type conversion operators.
7 // Cfront 2.0 does generate such calls.
9 // The following program exits with status 0 when compiled with Cfront 2.0
10 // but exits with status 1 when compiled with g++.
12 // Cfront 2.0 passes this test.
14 // 4/27/94 (jason): The pre-San Diego working paper prohibits operator
15 // void, so we can go back to just ignoring void values.
17 // keywords: user-defined type conversion operators, void type, explicit casts
19 // 8/3/2000 (nathan): The std allows you to define such an op, but
20 // it will never be called. [class.conv.fct]. Make it an unconditional warning.
22 struct struct0 {
24   operator void ();             // WARNING - operator void
27 int exit_status = 1;
29 struct0::operator void ()
31   exit_status = 0;
34 struct struct0 s0_object;
36 int test ()
38   (void) s0_object;
39   return exit_status;
42 int main () { return test (); }