[PATCH] D139586: [Clang][C++23] Lifetime extension in range-based for loops

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 15 15:53:35 PST 2022


hubert.reinterpretcast added a comment.

In D139586#3984118 <https://reviews.llvm.org/D139586#3984118>, @cor3ntin wrote:

> I will try to do a more detailed review later, but at least I think we might want more tests. Maybe codegen tests that do not rely on [[clang::lifetimebound]], and tests with more chaining (`a().b().c()`) .

We need to cover AST structure more than chaining. For example the patch currently does not find the `B()` temporary:

  struct A { ~A(); int x[3]; };
  struct B : A {};
  int (&f(const A *))[3];
  const A *g(const A &);
  void bar(int);
  void foo() {
    for (auto e : f(g(B()))) {
      bar(e);
    }
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139586/new/

https://reviews.llvm.org/D139586



More information about the cfe-commits mailing list