[all-commits] [llvm/llvm-project] 35d3b3: [C++20][Coroutines] Lambda-coroutine with operator...

Andreas Fertig via All-commits all-commits at lists.llvm.org
Fri Mar 8 08:10:43 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 35d3b33ba5c9b90443ac985f2521b78f84b611fe
      https://github.com/llvm/llvm-project/commit/35d3b33ba5c9b90443ac985f2521b78f84b611fe
  Author: Andreas Fertig <andy at cppinsights.io>
  Date:   2024-03-08 (Fri, 08 Mar 2024)

  Changed paths:
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaCoroutine.cpp
    M clang/lib/Sema/SemaExprCXX.cpp
    A clang/test/SemaCXX/gh84064-1.cpp
    A clang/test/SemaCXX/gh84064-2.cpp

  Log Message:
  -----------
  [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (#84193)

Fix #84064

According to http://eel.is/c++draft/dcl.fct.def.coroutine#9 the first
parameter for overload resolution of `operator new` is `size_t` followed
by the arguments of the coroutine function.
http://eel.is/c++draft/dcl.fct.def.coroutine#4 states that the first
argument is the lvalue of `*this` if the coroutine is a member function.

Before this patch, Clang handled class types correctly but ignored
lambdas. This patch adds support for lambda coroutines with a
`promise_type` that implements a custom `operator new`.

The patch does consider C++23 `static operator()`, which already worked
as there is no `this` parameter.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list