summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctor-neg.C
blob: 76ed7445f45deed9df44b5b9a594972df288f352 (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
// { dg-options -std=c++0x }

void f()
{
  int i;
  auto lam = [i]{};		// { dg-message "" }
  decltype(lam) lam2 = { 1 };	// { dg-error "" "not an aggregate" }
  decltype(lam) lam3;		// { dg-error "" "deleted default ctor" }
  lam3 = lam;			// { dg-error "" "deleted assignment op" }
}

template <class T>
void g(T i)
{
  auto lam = [i]{};		// { dg-message "" }
  decltype(lam) lam2 = { 1 };	// { dg-error "" "not an aggregate" }
  decltype(lam) lam3;		// { dg-error "" "deleted default ctor" }
  lam3 = lam;			// { dg-error "" "deleted assignment op" }
}

int main()
{
  f();
  g(1);
}