OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.brendan/] [overload2.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { 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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.