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++.jason/] [template36.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do run  }
2
// Testcase for implicit 'typename' and resolution of 'typename's in the
3
// current scope.
4
 
5
class base1 {
6
public:
7
    int bar() const
8
    { return 1; }
9
};
10
 
11
class base2 {
12
public:
13
    int bar() const
14
    { return 0; }
15
};
16
 
17
template
18
struct base_trait {
19
    typedef base1 base;
20
};
21
 
22
template<>
23
struct base_trait {
24
    typedef base2 base;
25
};
26
 
27
template
28
class weird : public base_trait::base {
29
public:
30
    typedef typename base_trait::base base;
31
 
32
    base f ();
33
    int base::* g ();
34
 
35
    int zowee() const
36
    { return this->bar(); }
37
};
38
 
39
template 
40
typename weird::base weird::f ()
41
{
42
    return base();
43
}
44
 
45
// The standard does not allow this case; the `typename' keyword may
46
// not appear in a ptr-operator.
47
#if 0
48
template 
49
int typename weird::base::* weird::g ()
50
{ return 0; }
51
#endif
52
 
53
int main()
54
{
55
    weird z;
56
    return z.zowee() || z.f().bar();
57
}

powered by: WebSVN 2.1.0

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