OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.jason/] [temporary3.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do run  }
2
// Bug: the temporary returned from f is elided, causing a to be constructed
3
// twice but only destroyed once.
4
 
5
extern "C" int printf (const char *, ...);
6
 
7
int c,d;
8
 
9
struct A {
10
  A (int) { c++; }
11
  ~A () { d++; }
12
  A (const A&) { c++; }
13
  int i;
14
};
15
 
16
A f ()
17
{ return 1; }
18
 
19
int main ()
20
{
21
  {
22
    A a (1);
23
    a = f ();
24
  }
25
  printf ("%d %d\n", c, d);
26
  return c != d;
27
}

powered by: WebSVN 2.1.0

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