[all-commits] [llvm/llvm-project] 1c0a90: [C++20] [Coroutines] Prefer sized deallocation in ...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Wed Sep 14 00:10:20 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1c0a90fd47bded1a6d5f31091e32cd79434bf4d4
      https://github.com/llvm/llvm-project/commit/1c0a90fd47bded1a6d5f31091e32cd79434bf4d4
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2022-09-14 (Wed, 14 Sep 2022)

  Changed paths:
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaCoroutine.cpp
    M clang/lib/Sema/SemaExprCXX.cpp
    M clang/test/CodeGenCoroutines/coro-alloc.cpp

  Log Message:
  -----------
  [C++20] [Coroutines] Prefer sized deallocation in promise_type

Now when the compiler can't find the sized deallocation function
correctly in promise_type if there are multiple deallocation function
overloads there.

According to [dcl.fct.def.coroutine]p12:
> If both a usual deallocation function with only a pointer parameter
> and a usual deallocation function with both a pointer parameter and a
> size parameter are found, then the selected deallocation function
> shall be the one with two parameters.

So when there are multiple deallocation functions, the compiler should
choose the sized one instead of the unsized one. The patch fixes this.




More information about the All-commits mailing list