Mercurial > hg > CbC > CbC_llvm
comparison clang/test/PCH/cxx1y-init-captures.cpp @ 150:1d019706d866
LLVM10
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 15:10:13 +0900 |
parents | |
children | 2e18cbf3894f |
comparison
equal
deleted
inserted
replaced
147:c2174574ed3a | 150:1d019706d866 |
---|---|
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 |