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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.jason/] [inline3.C] - Blame information for rev 699

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do run  }
2
// { dg-options "-O2" }
3
// Testcase for order of destruction.
4
 
5
extern "C" int printf (const char *, ...);
6
int c;
7
int r;
8
 
9
struct B {
10
  B();
11
  B( B const& );
12
  ~B();
13
};
14
 
15
struct A {
16
  A();
17
  A( A const& );
18
  ~A();
19
  operator B ();
20
};
21
 
22
inline A::operator B () { printf( "operator B ()\n"); return B(); }
23
 
24
A f();
25
void g( B const& );
26
 
27
int
28
main()
29
{
30
  g( f() );
31
  return r;
32
}
33
 
34
B::B() { printf( "B::B()\n" ); if (++c != 2) r = 1; }
35
B::B( B const& ) { printf( "B::B( B const& )\n" ); r = 1; }
36
B::~B() { printf( "B::~B()\n" ); if (--c != 1) r = 1; }
37
 
38
A::A() { printf( "A::A()\n" ); if (++c != 1) r = 1; }
39
A::A( A const& ) { printf( "A::A( A const& )\n" ); r = 1; }
40
A::~A() { printf( "A::~A()\n" ); if (--c != 0) r = 1; }
41
 
42
A f() { printf( "f()\n"); return A(); }
43
void g( B const& ) { printf( "g()\n"); }

powered by: WebSVN 2.1.0

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