OSDN Git Service

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