Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / g++.old-deja / g++.jason / template36.C
blob23cdb00e6debf8f9f50ed724e5c50401bbd276ee
1 // { dg-do run  }
2 // Testcase for implicit 'typename' and resolution of 'typename's in the
3 // current scope.
5 class base1 { 
6 public:
7     int bar() const
8     { return 1; }
9 };
11 class base2 { 
12 public:
13     int bar() const
14     { return 0; }
17 template<class X>
18 struct base_trait {
19     typedef base1 base;
22 template<>
23 struct base_trait<float> {
24     typedef base2 base;
27 template<class T>
28 class weird : public base_trait<T>::base {
29 public:
30     typedef typename base_trait<T>::base base;
32     base f ();
33     int base::* g ();
35     int zowee() const
36     { return this->bar(); }  
39 template <class T>
40 typename weird<T>::base weird<T>::f ()
42     return base();
45 // The standard does not allow this case; the `typename' keyword may
46 // not appear in a ptr-operator.
47 #if 0
48 template <class T>
49 int typename weird<T>::base::* weird<T>::g ()
50 { return 0; }
51 #endif
53 int main()
55     weird<float> z;
56     return z.zowee() || z.f().bar();