aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/init/byval1.C
blob: 86c6e46830d3d6938266f5eae9a634d4b0886315 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// PR c++/3948
// Test that the destructor call for a value parameter gets the
// right address.

// { dg-do run }

void *p[2];
int i;
int r;

struct C
{
  int m;
  
  C() { p[i++] = this; }
  ~C() { if (p[--i] != this) r = 1; }
};


void Foo (C c)
{
  p[i++] = &c;
}

int main ()
{       
  C c;

  Foo (c);
  return r;
}