FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.benjamin / 14687.C
blob6897fe943a46146b039dda548a68aa8cf96ef40a
1 // 981203 bkoz
2 // g++/14687
4 #include <assert.h>
5 unsigned int gtest;
7 // 7.3.3 the using declaration
9 // p 3
10 struct belieze {
11   void f(char);
12   void g(char);
13   enum E { e };
14   union { int x; };
17 struct dominica: belieze {
18   using belieze::f;
19   void f(int i) { f('c'); } // calls belieze::f(char)
20   void g(int i) { g('c'); } // recursively calls dominca::g(int)
24 // p 6
25 namespace A {
26   void f(int i) { gtest = 1; }
29 using A::f;      //f is a synonym for A::f, that is for A::f(int)
31 namespace A {
32   void f(char c) { gtest = 3; }
35 void foo(void) {
36   f('a');        //calls f(int), even though A::f(char) exits
37   assert (gtest = 1);
40 void bar(void) {
41   using A::f;    //f is a synonm for A::f, that is for A::f(int) and A::f(char)
42   f('a');        //calls f(char)
43   assert (gtest = 3);
46 int main(void)
48   foo();
49   bar();
51   return 0;