summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tc1/dr20.C
blob: fe586212995de927aa45398f7644d36b09a3d253 (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
32
33
34
// { dg-do run }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR20: Some clarifications needed for 12.8 para 15 

extern "C" void printf(const char*, ...);
extern "C" void abort(void);

int count = 0;

class Thing {
public:
  Thing() {
  }
  ~Thing() {
  }
  Thing(const Thing&)
  {
    count += 1;
  }
};

Thing f() {
  Thing t;
  return t;
}

int main(void)
{
  Thing t2 = f();
  printf("%d %x\n", count, &t2);
  if (count != 0)
    abort();
  return 0;
}