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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [abi/] [covariant4.C] - Diff between revs 149 and 154

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

Rev 149 Rev 154
// { dg-do run  }
// { dg-do run  }
// Copyright (C) 2005 Free Software Foundation, Inc.
// Copyright (C) 2005 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 11 Feb 2005 
// Contributed by Nathan Sidwell 11 Feb 2005 
// Origin: bredelin@ucla.edu
// Origin: bredelin@ucla.edu
// Bug 19891: Incorrect covariant vtables
// Bug 19891: Incorrect covariant vtables
struct Model {
struct Model {
  bool full_tree;
  bool full_tree;
  virtual Model* clone() const =0;
  virtual Model* clone() const =0;
  virtual const char *name() const =0;
  virtual const char *name() const =0;
  virtual ~Model() {}
  virtual ~Model() {}
};
};
struct R: virtual public Model {
struct R: virtual public Model {
  virtual R* clone() const =0;
  virtual R* clone() const =0;
};
};
struct A: virtual public Model {
struct A: virtual public Model {
  virtual A* clone() const=0;
  virtual A* clone() const=0;
};
};
struct RA: public R, public A {
struct RA: public R, public A {
  virtual RA* clone() const=0;
  virtual RA* clone() const=0;
};
};
static const char *string = "EQU";
static const char *string = "EQU";
struct EQU: public RA {
struct EQU: public RA {
  virtual EQU* clone() const {return new EQU(*this);}
  virtual EQU* clone() const {return new EQU(*this);}
  const char *name() const {return string;}
  const char *name() const {return string;}
};
};
int main() {
int main() {
  Model* M1 = new EQU();
  Model* M1 = new EQU();
  Model* M2 = M1->clone();
  Model* M2 = M1->clone();
  Model* M3 = M2->clone();
  Model* M3 = M2->clone();
  if (M1->name () != string)
  if (M1->name () != string)
    return 1;
    return 1;
  if (M2->name () != string)
  if (M2->name () != string)
    return 2;
    return 2;
  if (M3->name () != string)
  if (M3->name () != string)
    return 3;
    return 3;
  return 0;
  return 0;
}
}
 
 

powered by: WebSVN 2.1.0

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