| 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 |
// RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch -fpch-instantiate-templates %s -o %t |
| 9 |
// RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s |
| 10 |
|
| 11 |
#ifndef HEADER |
| 12 |
#define HEADER |
| 13 |
|
| 14 |
auto counter = [a(0)] () mutable { return a++; }; |
| 15 |
int x = counter(); |
| 16 |
|
| 17 |
template<typename T> void f(T t) { |
| 18 |
[t(t)] { int n = t; } (); |
| 19 |
} |
| 20 |
|
| 21 |
#else |
| 22 |
|
| 23 |
int y = counter(); |
| 24 |
|
| 25 |
void g() { |
| 26 |
f(0); // ok |
| 27 |
// expected-error@18 {{lvalue of type 'const char *const'}} |
| 28 |
// expected-note@18 {{substituting into a lambda}} |
| 29 |
f("foo"); // expected-note {{here}} |
| 30 |
} |
| 31 |
|
| 32 |
#endif |