]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/PCH/cxx1y-init-captures.cpp
Vendor import of clang release_40 branch r292951:
[FreeBSD/FreeBSD.git] / test / PCH / cxx1y-init-captures.cpp
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
11 auto counter = [a(0)] () mutable { return a++; };
12 int x = counter();
13
14 template<typename T> void f(T t) {
15   [t(t)] { int n = t; } ();
16 }
17
18 #else
19
20 int y = counter();
21
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