summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/pr57958.C
blob: d35f9edf2ae0f9c3f9811ea713a7bd1704dfa8eb (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
35
36
37
38
39
// { dg-do run { target c++11 } }

#define assert(E) if(!(E))__builtin_abort();

int n = 0;

template <class T>
class Foo {
 public:
  Foo() { 
   n--; 
  }
  Foo(const Foo&) { 
   n--; 
  }
  ~Foo() { 
   n++; 
  }
};

struct Data {};

void a()
{
	Data b;
}

int main(int argc, char *argv[]) {
  auto fn = [] (const Foo<Data>& x) {
    return (x);
  };

  {
    Foo<Data> a;
    fn(a);
  }

  assert(n == 0);
}