| 1 |
// { dg-do run } |
| 2 |
|
| 3 |
// Copyright (C) 2003 Free Software Foundation, Inc. |
| 4 |
// Contributed by Nathan Sidwell 22 Jul 2003 <[email protected]> |
| 5 |
|
| 6 |
// PR 9447. Using decls in template classes. |
| 7 |
|
| 8 |
template <class T> |
| 9 |
struct Foo { |
| 10 |
int i; |
| 11 |
}; |
| 12 |
|
| 13 |
struct Baz |
| 14 |
{ |
| 15 |
int j; |
| 16 |
}; |
| 17 |
|
| 18 |
template <class T> |
| 19 |
struct Bar : public Foo<T>, Baz { |
| 20 |
using Foo<T>::i; |
| 21 |
using Baz::j; |
| 22 |
|
| 23 |
int foo () { return i; } |
| 24 |
int baz () { return j; } |
| 25 |
}; |
| 26 |
|
| 27 |
int main() |
| 28 |
{ |
| 29 |
Bar<int> bar; |
| 30 |
|
| 31 |
bar.i = 1; |
| 32 |
bar.j = 2; |
| 33 |
|
| 34 |
if (bar.foo() != 1) |
| 35 |
return 1; |
| 36 |
|
| 37 |
if (bar.baz() != 2) |
| 38 |
return 1; |
| 39 |
|
| 40 |
return 0; |
| 41 |
} |
| 42 |
|