xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/cxx1y-init-captures.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1 // No PCH:
2 // RUN: %clang_cc1 -pedantic -std=c++1y -include %s -verify %s
3 //
4 // With PCH:
5 // RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t
6 // RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s
7 
8 #ifndef HEADER
9 #define HEADER
10 
__anond55862d20102() 11 auto counter = [a(0)] () mutable { return a++; };
12 int x = counter();
13 
f(T t)14 template<typename T> void f(T t) {
15   [t(t)] { int n = t; } ();
16 }
17 
18 #else
19 
20 int y = counter();
21 
g()22 void g() {
23   f(0); // ok
24   // expected-error@15 {{lvalue of type 'const char *const'}}
25   f("foo"); // expected-note {{here}}
26 }
27 
28 #endif
29