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] - Diff between revs 305 and 338

Only display areas with differences | Details | Blame | View Log

Rev 305 Rev 338
// { dg-do run  }
// { dg-do run  }
// GROUPS passed templates
// GROUPS passed templates
extern "C" int printf (const char *, ...);
extern "C" int printf (const char *, ...);
extern "C" void exit (int);
extern "C" void exit (int);
int count = 0;
int count = 0;
void
void
die (int x)
die (int x)
{
{
  if (x != ++count)
  if (x != ++count)
    {
    {
      printf ("FAIL\n");
      printf ("FAIL\n");
      exit (1);
      exit (1);
    }
    }
}
}
class A {
class A {
  public:
  public:
    void   f() const { die (-1); }
    void   f() const { die (-1); }
};
};
template 
template 
class B : public A {
class B : public A {
  public:
  public:
  void f() const;
  void f() const;
};
};
template 
template 
inline void B::f() const { die (1); }
inline void B::f() const { die (1); }
template 
template 
class C : public A {
class C : public A {
  public:
  public:
    void f() const { die (2); }
    void f() const { die (2); }
};
};
int main()
int main()
{
{
    B b;
    B b;
    C c;
    C c;
    b.f(); //- bugged, (A::f() called instead of B::f())
    b.f(); //- bugged, (A::f() called instead of B::f())
    c.f(); //- works fine (C::f() called)
    c.f(); //- works fine (C::f() called)
    printf ("PASS\n");
    printf ("PASS\n");
    return 0;
    return 0;
}
}
 
 

powered by: WebSVN 2.1.0

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