OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.brendan/] [template3.C] - Blame information for rev 305

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

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do run  }
2
// GROUPS passed templates
3
extern "C" int printf (const char *, ...);
4
extern "C" void exit (int);
5
 
6
int count = 0;
7
 
8
void
9
die (int x)
10
{
11
  if (x != ++count)
12
    {
13
      printf ("FAIL\n");
14
      exit (1);
15
    }
16
}
17
 
18
class A {
19
  public:
20
    void   f() const { die (-1); }
21
};
22
 
23
 
24
template 
25
class B : public A {
26
  public:
27
  void f() const;
28
};
29
 
30
template 
31
inline void B::f() const { die (1); }
32
 
33
template 
34
class C : public A {
35
  public:
36
    void f() const { die (2); }
37
};
38
 
39
 
40
int main()
41
{
42
    B b;
43
    C c;
44
 
45
    b.f(); //- bugged, (A::f() called instead of B::f())
46
    c.f(); //- works fine (C::f() called)
47
 
48
    printf ("PASS\n");
49
    return 0;
50
}

powered by: WebSVN 2.1.0

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