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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [init/] [array25.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// related to PR c++/38233
2
// test for value-init of a member array
3
// { dg-do run }
4
 
5
struct elt
6
{
7
  virtual void f();
8
  char c;
9
};
10
 
11
void elt::f() { }
12
 
13
struct foo {
14
  elt buffer[500];
15
  foo() ;
16
  bool check () const;
17
};
18
 
19
foo::foo ()
20
  : buffer()
21
{}
22
 
23
bool foo::check () const
24
{
25
  for (unsigned ix = sizeof (buffer)/ sizeof (buffer[0]); ix--;)
26
    if (buffer[ix].c)
27
      return false;
28
  return true;
29
}
30
 
31
inline void *operator new (__SIZE_TYPE__ size, void *p)
32
{
33
  return p;
34
}
35
 
36
char heap[sizeof(elt[500])];
37
 
38
int main ()
39
{
40
  for (unsigned ix = sizeof (heap); ix--;)
41
    heap[ix] = ix;
42
 
43
  foo *f = new (heap) foo ();
44
  if (!f->check ())
45
    return 3;
46
  return 0;
47
}
48
 
49
 

powered by: WebSVN 2.1.0

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