annotate clang/test/PCH/cxx1y-init-captures.cpp @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 79ff65ed7e25
children 1f2b6ac9f198
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // No PCH:
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -pedantic -std=c++1y -include %s -verify %s
anatofuz
parents:
diff changeset
3 //
anatofuz
parents:
diff changeset
4 // With PCH:
anatofuz
parents:
diff changeset
5 // RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t
anatofuz
parents:
diff changeset
6 // RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s
anatofuz
parents:
diff changeset
7
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
8 // RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch -fpch-instantiate-templates %s -o %t
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
9 // RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
10
150
anatofuz
parents:
diff changeset
11 #ifndef HEADER
anatofuz
parents:
diff changeset
12 #define HEADER
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 auto counter = [a(0)] () mutable { return a++; };
anatofuz
parents:
diff changeset
15 int x = counter();
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 template<typename T> void f(T t) {
anatofuz
parents:
diff changeset
18 [t(t)] { int n = t; } ();
anatofuz
parents:
diff changeset
19 }
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 #else
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 int y = counter();
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 void g() {
anatofuz
parents:
diff changeset
26 f(0); // ok
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
27 // expected-error@18 {{lvalue of type 'const char *const'}}
150
anatofuz
parents:
diff changeset
28 f("foo"); // expected-note {{here}}
anatofuz
parents:
diff changeset
29 }
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 #endif