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/] [empty1.C] - Blame information for rev 699

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do run  }
2
// Origin: Mark Mitchell 
3
// This test case checks that the return value optimization works for
4
// empty classes.
5
 
6
// PR c++/5995
7
 
8
extern "C" void abort();
9
extern "C" int printf (const char *, ...);
10
 
11
int i;
12
 
13
struct A;
14
 
15
struct A* as[10];
16
 
17
struct A {
18
  A () { as[i++] = this; }
19
  A (const A&) { as[i++] = this; }
20
  ~A() { if (i == 0 || as[--i] != this) abort(); }
21
};
22
 
23
A f() { return A(); }
24
 
25
int main ()
26
{
27
  A a (f ());
28
}

powered by: WebSVN 2.1.0

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