900519_02.C revision 1.1.1.1
1// g++ 1.37.1 bug 900519_02 2 3// The C++ Reference Manual says (in section 8.4.3) "A reference to a plain 4// T can only be initialized with a plain T" however g++ allows the 5// initialization of plain references with qualified objects in many cases. 6 7// keywords: references, initialization, type qualifiers 8 9extern const int cint_obj = 9; 10volatile int vint_obj = 9; 11 12void take_int_ref (int& arg) { } // ERROR - referenced by errors below 13 14int& global_int_ref0 = cint_obj; // ERROR - 15int& global_int_ref1 = vint_obj; // ERROR - 16 17extern const int& cint_ref; 18extern volatile int& vint_ref; 19 20void test_0 () 21{ 22 int& local_int_ref0 = cint_obj; // ERROR - 23 int& local_int_ref1 = vint_obj; // ERROR - 24 25 take_int_ref (cint_obj); // ERROR - caught 26 take_int_ref (vint_obj); // ERROR - 27 28 take_int_ref (cint_ref); // ERROR - 29 take_int_ref (vint_ref); // ERROR - 30} 31 32int main () { return 0; } 33