Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.brendan/overload2.C

raw
1 // { dg-do run }
2 // GROUPS passed overloading
3 // Check that calls to the correct overloaded virtual
4 // functions are generated even where the type of the formal
5 // arguments for the overloadings are similar or related.
6
7 extern "C" int printf (const char *, ...);
8
9 int proper_method_called = 0;
10
11 struct base {
12 int member;
13 virtual void method (char)
14 {
15 }
16 virtual void method (char *)
17 {
18 }
19 };
20
21 struct derived : public base {
22 int member;
23 virtual void method (char)
24 {
25 }
26 virtual void method (char *)
27 {
28 proper_method_called++;
29 }
30 };
31
32 char *message;
33
34 int main ()
35 {
36 derived derived_object;
37
38 derived_object.method (message);
39
40 if (proper_method_called != 1)
41 { printf ("FAIL\n"); return 1; }
42 else
43 printf ("PASS\n");
44 }