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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [lookup/] [using39.C] - Blame information for rev 717

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do run }
2
 
3
template 
4
struct A
5
{
6
    int f() { return 1; }
7
};
8
 
9
template 
10
struct B : A
11
{
12
    int f() { return 2; }
13
 
14
    using A::f;
15
    void g()
16
    {
17
        if (A::f() != 1 )
18
            __builtin_abort();
19
 
20
        if( B::f() != 2 )
21
            __builtin_abort();
22
 
23
        if( this->f() != 2 )
24
            __builtin_abort();
25
    }
26
};
27
 
28
template 
29
struct C
30
{
31
    int h( int i ) { return 1; }
32
    int h( double d ) { return 2; }
33
};
34
 
35
template 
36
struct D : private C
37
{
38
    using C::h;
39
    int h( char c ) { return 0; }
40
    int h() { return 3; }
41
};
42
 
43
int main()
44
{
45
    B b;
46
    b.g();
47
    b.f();
48
    b.A::f();
49
    b.B::f();
50
 
51
    D d;
52
    if( d.h( 'a' ) != 0 )
53
        __builtin_abort();
54
 
55
    if( d.h( 3 ) != 1 )
56
        __builtin_abort();
57
 
58
    if( d.h( 3.14 ) != 2 )
59
        __builtin_abort();
60
 
61
    if( d.h() != 3 )
62
        __builtin_abort();
63
}

powered by: WebSVN 2.1.0

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