1 // RUN: %clang_cc1 -pedantic-errors -fblocks -std=c++1y -emit-pch %s -o %t-cxx1y
2 // RUN: %clang_cc1 -ast-print -pedantic-errors -fblocks -std=c++1y -include-pch %t-cxx1y %s | FileCheck -check-prefix=CHECK-PRINT %s
4 #ifndef HEADER_INCLUDED
6 #define HEADER_INCLUDED
8 T add_slowly(const T& x, const T &y) {
9 return [](auto z, int y = 0) { return z + y; }(5);
12 inline int add_int_slowly_twice(int x, int y) {
13 int i = add_slowly(x, y);
14 auto lambda = [](auto z) { return z + z; };
18 inline int sum_array(int n) {
19 auto lambda = [](auto N) -> int {
21 int array[5] = { 1, 2, 3, 4, 5};
23 for (unsigned I = 0; I < N; ++I)
31 inline int to_block_pointer(int n) {
32 auto lambda = [=](int m) { return n + m; };
33 int (^block)(int) = lambda;
38 int init_capture(T t) {
39 return [&, x(t)] { return sizeof(x); };
42 auto with_pack = [](auto ...xs){};
46 // CHECK-PRINT: T add_slowly
47 // CHECK-PRINT: return []
48 template float add_slowly(const float&, const float&);
50 int add(int x, int y) {
51 return add_int_slowly_twice(x, y) + sum_array(4) + to_block_pointer(5);
54 // CHECK-PRINT: inline int add_int_slowly_twice
55 // CHECK-PRINT: lambda = [](auto z
57 // CHECK-PRINT: init_capture
58 // CHECK-PRINT: [&, x(t)]
60 void use_with_pack() { with_pack(1, 2, 3); }