1// g++ 1.36.1 bug 900220_03 2 3// g++ does not properly disambiguate calls to overloaded functions 4// which are nearly identical except that one take a reference to a 5// type `T' object and another takes a reference to a type `const T' 6// object. 7 8// (Note that the volatile stuff is commented out here because cfront 9// does not yet grok volatile.) 10 11// Cfront 2.0 passes this test. 12 13// keywords: references, overloading, type qualifiers, pointers 14 15int c_call_count = 0; 16int cc_call_count = 0; 17//int vc_call_count = 0; 18 19void overloaded (char&) 20{ 21 c_call_count++; 22} 23 24void overloaded (const char&) 25{ 26 cc_call_count++; 27} 28 29//void overloaded (volatile char&) 30//{ 31// vc_call_count++; 32//} 33 34int test () 35{ 36 char c = 0; 37 const char cc = 0; 38 //volatile char vc = 0; 39 40 char& cr = c; 41 const char& ccr = cc; 42 //volatile char& vcr = vc; 43 44 overloaded (c); // OK 45 overloaded (cc); // gets bogus error 46 //overloaded (vc); // OK 47 48 return (c_call_count != 1 || cc_call_count != 1 /* || vc_call_count != 1 */); 49} 50 51int main () { return test (); } 52