summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/using6.C
blob: 272c35dffb6e5ce796b416f992ebe8b3d3a5fa06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// { dg-do run  }
// Test of class-scope using-declaration for functions.

#define assert(COND) if (!(COND)) return 1

struct A {
  int f(int) { return 1; }
  int f(char) { return 2; }
};

struct B {
  int f(double) { return 3; }
};

struct C : public A, public B {
  using A::f;
  using B::f;
  int f(char) { return 4; }
  int f(C) { return 5; }
};

int main ()
{
  C c;

  assert (c.f(1) == 1);
  assert (c.f('a') == 4);
  assert (c.f(2.0) == 3);
  assert (c.f(c) == 5);
}