repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Clean up some minor white space issues in trans-decl.c and trans-expr.c
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
lookup
/
using39.C
blob
56ae89a4a2251f68c32a7228324c6b0f4aa8dea0
1
// { dg-do run }
2
3
template <class T>
4
struct A
5
{
6
int f() { return 1; }
7
};
8
9
template <class T>
10
struct B : A<T>
11
{
12
int f() { return 2; }
13
14
using A<T>::f;
15
void g()
16
{
17
if (A<T>::f() != 1 )
18
__builtin_abort();
19
20
if( B<T>::f() != 2 )
21
__builtin_abort();
22
23
if( this->f() != 2 )
24
__builtin_abort();
25
}
26
};
27
28
template <class T>
29
struct C
30
{
31
int h( int i ) { return 1; }
32
int h( double d ) { return 2; }
33
};
34
35
template <class T>
36
struct D : private C<T>
37
{
38
using C<T>::h;
39
int h( char c ) { return 0; }
40
int h() { return 3; }
41
};
42
43
int main()
44
{
45
B<int> b;
46
b.g();
47
b.f();
48
b.A<int>::f();
49
b.B<int>::f();
50
51
D<int> 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
}