brintos

brintos / llvm-project-archived public Read only

0
0
Text · 754 B · c19dd90 Raw
33 lines · cpp
1// No PCH:2// RUN: %clang_cc1 -pedantic -std=c++1y -include %s -verify %s3//4// With PCH:5// RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t6// RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s7 8// RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch -fpch-instantiate-templates %s -o %t9// RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s10 11#ifndef HEADER12#define HEADER13 14auto counter = [a(0)] () mutable { return a++; };15int x = counter();16 17template<typename T> void f(T t) {18  [t(t)] { int n = t; } ();19}20 21#else22 23int y = counter();24 25void g() {26  f(0); // ok27  // 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#endif33