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/] [thunk3.C] - Diff between revs 305 and 338

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

Rev 305 Rev 338
// { dg-do run { xfail rs6000-*-* powerpc-*-eabi v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa*-*-* m32r*-*-* lm32-*-* } }
// { dg-do run { xfail rs6000-*-* powerpc-*-eabi v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa*-*-* m32r*-*-* lm32-*-* } }
// Test that variadic function calls using thunks work right.
// Test that variadic function calls using thunks work right.
// Note that this will break on any target that uses the generic thunk
// Note that this will break on any target that uses the generic thunk
//  support, because it doesn't support variadic functions.
//  support, because it doesn't support variadic functions.
#include 
#include 
struct A {
struct A {
  void* p;
  void* p;
  A (void* q): p (q) { }
  A (void* q): p (q) { }
  A (const A& a): p (a.p) { }
  A (const A& a): p (a.p) { }
};
};
class CBase {
class CBase {
public:
public:
   virtual void BaseFunc();
   virtual void BaseFunc();
};
};
class MMixin {
class MMixin {
public:
public:
   virtual A MixinFunc(int arg, ...) = 0;
   virtual A MixinFunc(int arg, ...) = 0;
};
};
class CExample : public CBase, public MMixin {
class CExample : public CBase, public MMixin {
public:
public:
   A MixinFunc(int arg, ...);
   A MixinFunc(int arg, ...);
};
};
void CBase::BaseFunc()
void CBase::BaseFunc()
{
{
}
}
A CExample::MixinFunc(int arg, ...)
A CExample::MixinFunc(int arg, ...)
{
{
  va_list ap;
  va_list ap;
  va_start (ap, arg);
  va_start (ap, arg);
  if (arg != 1 || va_arg (ap, int) != 2 || va_arg (ap, int) != 3
  if (arg != 1 || va_arg (ap, int) != 2 || va_arg (ap, int) != 3
      || va_arg (ap, int) != 4 || va_arg (ap, int) != 5
      || va_arg (ap, int) != 4 || va_arg (ap, int) != 5
      || va_arg (ap, int) != 6 || va_arg (ap, int) != 7
      || va_arg (ap, int) != 6 || va_arg (ap, int) != 7
      || va_arg (ap, int) != 8 || va_arg (ap, int) != 9)
      || va_arg (ap, int) != 8 || va_arg (ap, int) != 9)
    return 0;
    return 0;
  return this;
  return this;
}
}
void* test(MMixin& anExample)
void* test(MMixin& anExample)
{
{
  return anExample.MixinFunc(1,2,3,4,5,6,7,8,9).p;
  return anExample.MixinFunc(1,2,3,4,5,6,7,8,9).p;
}
}
int main ()
int main ()
{
{
  CExample c;
  CExample c;
  if (test(c) != &c)
  if (test(c) != &c)
    return 1;
    return 1;
}
}
 
 

powered by: WebSVN 2.1.0

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