1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 \ 2 // RUN: -emit-llvm %s -o - -disable-llvm-passes \ 3 // RUN: | FileCheck %s 4 5 #include "Inputs/coroutine.h" 6 7 namespace std { 8 typedef __SIZE_TYPE__ size_t; 9 enum class align_val_t : size_t {}; 10 } 11 12 struct task { 13 struct promise_type { initial_suspendtask::promise_type14 auto initial_suspend() { return std::suspend_always{}; } final_suspendtask::promise_type15 auto final_suspend() noexcept { return std::suspend_always{}; } get_return_objecttask::promise_type16 auto get_return_object() { return task{}; } unhandled_exceptiontask::promise_type17 void unhandled_exception() {} return_valuetask::promise_type18 void return_value(int) {} 19 }; 20 }; 21 22 // Test the compiler will chose sized deallocation correctly. 23 void operator delete(void *ptr, std::size_t size) noexcept; 24 25 // CHECK: define{{.*}}@_Z1fv 26 // CHECK: %[[coro_free:.+]] = call{{.*}}@llvm.coro.free 27 // CHECK: coro.free: 28 // CHECK: %[[coro_size:.+]] = call{{.*}}@llvm.coro.size 29 // CHECK: call{{.*}}void @_ZdlPvm(ptr{{.*}}%[[coro_free]], i64{{.*}}%[[coro_size]]) 30 f()31task f() { 32 co_return 43; 33 } 34