// { dg-do run }
|
// { dg-do run }
|
// g++ 1.36.1 bug 900220_03
|
// g++ 1.36.1 bug 900220_03
|
|
|
// g++ does not properly disambiguate calls to overloaded functions
|
// g++ does not properly disambiguate calls to overloaded functions
|
// which are nearly identical except that one take a reference to a
|
// which are nearly identical except that one take a reference to a
|
// type `T' object and another takes a reference to a type `const T'
|
// type `T' object and another takes a reference to a type `const T'
|
// object.
|
// object.
|
|
|
// (Note that the volatile stuff is commented out here because cfront
|
// (Note that the volatile stuff is commented out here because cfront
|
// does not yet grok volatile.)
|
// does not yet grok volatile.)
|
|
|
// Cfront 2.0 passes this test.
|
// Cfront 2.0 passes this test.
|
|
|
// keywords: references, overloading, type qualifiers, pointers
|
// keywords: references, overloading, type qualifiers, pointers
|
|
|
int c_call_count = 0;
|
int c_call_count = 0;
|
int cc_call_count = 0;
|
int cc_call_count = 0;
|
//int vc_call_count = 0;
|
//int vc_call_count = 0;
|
|
|
void overloaded (char&)
|
void overloaded (char&)
|
{
|
{
|
c_call_count++;
|
c_call_count++;
|
}
|
}
|
|
|
void overloaded (const char&)
|
void overloaded (const char&)
|
{
|
{
|
cc_call_count++;
|
cc_call_count++;
|
}
|
}
|
|
|
//void overloaded (volatile char&)
|
//void overloaded (volatile char&)
|
//{
|
//{
|
// vc_call_count++;
|
// vc_call_count++;
|
//}
|
//}
|
|
|
int test ()
|
int test ()
|
{
|
{
|
char c = 0;
|
char c = 0;
|
const char cc = 0;
|
const char cc = 0;
|
//volatile char vc = 0;
|
//volatile char vc = 0;
|
|
|
char& cr = c;
|
char& cr = c;
|
const char& ccr = cc;
|
const char& ccr = cc;
|
//volatile char& vcr = vc;
|
//volatile char& vcr = vc;
|
|
|
overloaded (c); // OK
|
overloaded (c); // OK
|
overloaded (cc); // { dg-bogus "" }
|
overloaded (cc); // { dg-bogus "" }
|
//overloaded (vc); // OK
|
//overloaded (vc); // OK
|
|
|
return (c_call_count != 1 || cc_call_count != 1 /* || vc_call_count != 1 */);
|
return (c_call_count != 1 || cc_call_count != 1 /* || vc_call_count != 1 */);
|
}
|
}
|
|
|
int main () { return test (); }
|
int main () { return test (); }
|
|
|