OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [template/] [overload7.C] - Blame information for rev 801

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

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do run }
2
 
3
// Copyright (C) 2005 Free Software Foundation, Inc.
4
// Contributed by Nathan Sidwell 17 Oct 2005 
5
 
6
// PR 24386:Wrong virtual function called
7
// Origin:  Scott Snyder snyder@fnal.gov
8
 
9
struct A
10
{
11
  virtual int Foo () { return 1; }
12
};
13
struct B : public A
14
{
15
  virtual int Foo () { return 2; }
16
};
17
 
18
template 
19
int Bar (T *a)
20
{
21
  if (static_cast(a)->A::Foo () != 1)
22
    return 1;
23
  if (static_cast(a)->Foo () != 2)
24
    return 2;
25
  return 0;
26
}
27
 
28
int main ()
29
{
30
  return Bar (new B);
31
}

powered by: WebSVN 2.1.0

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