summaryrefslogtreecommitdiffstats
path: root/test/PCH/cxx1y-init-captures.cpp
blob: 3c8fc149d84ba5b125cecf101f735dd25bdb262a (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
// No PCH:
// RUN: %clang_cc1 -pedantic -std=c++1y -include %s -verify %s
//
// With PCH:
// RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t
// RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s

#ifndef HEADER
#define HEADER

auto counter = [a(0)] () mutable { return a++; };
int x = counter();

template<typename T> void f(T t) {
  [t(t)] { int n = t; } ();
}

#else

int y = counter();

void g() {
  f(0); // ok
  // expected-error@15 {{lvalue of type 'const char *const'}}
  f("foo"); // expected-note {{here}}
}

#endif