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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.other/] [new6.C] - Blame information for rev 749

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

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do run  }
2
// Test that we properly default-initialize the new int when () is given.
3
 
4
#include 
5
using namespace std;
6
extern "C" void *malloc (size_t);
7
 
8
int special;
9
int space = 0xdeadbeef;
10
 
11
void *operator new (size_t size)
12
#if __cplusplus <= 199711L
13
  throw (std::bad_alloc)
14
#endif
15
{
16
  if (special)
17
    return &space;
18
  return malloc (size);
19
}
20
 
21
int main ()
22
{
23
  special = 1;
24
  int *p = new int();
25
  special = 0;
26
  return *p != 0;
27
}

powered by: WebSVN 2.1.0

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