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/] [expr/] [anew4.C] - Diff between revs 149 and 154

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

Rev 149 Rev 154
// { dg-do run { xfail *-*-* } }
// { dg-do run { xfail *-*-* } }
// XFAILed until PR2123 is fixed
// XFAILed until PR2123 is fixed
// PR 11228: array operator new, with zero-initialization and a variable sized array.
// PR 11228: array operator new, with zero-initialization and a variable sized array.
// Regression test for PR
// Regression test for PR
// Author: Matt Austern 
// Author: Matt Austern 
#include 
#include 
#include 
#include 
#include 
#include 
struct B
struct B
{
{
  B();
  B();
  int n;
  int n;
};
};
B::B()
B::B()
{
{
  n = 137;
  n = 137;
}
}
struct D : public B
struct D : public B
{
{
  double x;
  double x;
};
};
D* allocate(int n)
D* allocate(int n)
{
{
  void *p;
  void *p;
  p = malloc(n * sizeof (D));
  p = malloc(n * sizeof (D));
  memset (p, 0xff, n * sizeof(D));
  memset (p, 0xff, n * sizeof(D));
  return new (p) D[n]();
  return new (p) D[n]();
}
}
int main()
int main()
{
{
  const int n = 17;
  const int n = 17;
  D* p = allocate(n);
  D* p = allocate(n);
  for (int i = 0; i < n; ++i)
  for (int i = 0; i < n; ++i)
    if (p[i].n != 137 || p[i].x != 0)
    if (p[i].n != 137 || p[i].x != 0)
      abort ();
      abort ();
  exit (0);
  exit (0);
}
}
 
 

powered by: WebSVN 2.1.0

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