"Fossies" - the Fresh Open Source Software Archive

Member "cfe-9.0.0.src/test/AST/ast-printer-lambda.cpp" (5 May 2019, 495 Bytes) of package /linux/misc/cfe-9.0.0.src.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // RUN: %clang_cc1 -ast-print -std=c++17 %s | FileCheck %s
    2 
    3 struct S {
    4 template<typename ... T>
    5 void test1(int i, T... t) {
    6 {
    7   auto lambda = [i]{};
    8   //CHECK: [i] {
    9 }
   10 {
   11   auto lambda = [=]{};
   12   //CHECK: [=] {
   13 }
   14 {
   15   auto lambda = [&]{};
   16   //CHECK: [&] {
   17 }
   18 {
   19   auto lambda = [t..., i]{};
   20   //CHECK: [t..., i] {
   21 }
   22 {
   23   auto lambda = [&t...]{};
   24   //CHECK: [&t...] {
   25 }
   26 {
   27   auto lambda = [this, &t...]{};
   28   //CHECK: [this, &t...] {
   29 }
   30 {
   31   auto lambda = [t..., this]{};
   32   //CHECK: [t..., this] {
   33 }
   34 }
   35 
   36 };