brintos

brintos / llvm-project-archived public Read only

0
0
Text · 595 B · 4e8e94d Raw
35 lines · cpp
1// RUN: %clang_cc1 -std=c++23 -verify %s2// expected-no-diagnostics3 4struct S {5  int i = 42;6  constexpr auto f1() {7    return [this](this auto) {8      return this->i;9    }();10  };11 12  constexpr auto f2() {13    return [this](this auto&&) {14      return this->i;15    }();16  };17 18  constexpr auto f3() {19    return [i = this->i](this auto) {20      return i;21    }();22  };23 24  constexpr auto f4() {25    return [i = this->i](this auto&&) {26      return i;27    }();28  };29};30 31static_assert(S().f1() == 42);32static_assert(S().f2() == 42);33static_assert(S().f3() == 42);34static_assert(S().f4() == 42);35