| 1 |
// Tests that the behavior will be good if there are multiple operator delete in the promise_type. |
| 2 |
// RUN: %clang_cc1 %s -std=c++20 %s -fsyntax-only -verify |
| 3 |
// expected-no-diagnostics |
| 4 |
|
| 5 |
#include "Inputs/std-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 { |
| 14 |
auto initial_suspend() { return std::suspend_always{}; } |
| 15 |
auto final_suspend() noexcept { return std::suspend_always{}; } |
| 16 |
auto get_return_object() { return task{}; } |
| 17 |
void unhandled_exception() {} |
| 18 |
void return_value(int) {} |
| 19 |
|
| 20 |
void operator delete(void *ptr, void *meaningless_placeholder); |
| 21 |
void operator delete(void *ptr); |
| 22 |
}; |
| 23 |
}; |
| 24 |
|
| 25 |
task f() { |
| 26 |
co_return 43; |
| 27 |
} |
| 28 |
|
| 29 |
// From https://github.com/llvm/llvm-project/issues/60545 |
| 30 |
struct generator { |
| 31 |
struct promise_type { |
| 32 |
generator get_return_object(); |
| 33 |
std::suspend_always initial_suspend(); |
| 34 |
std::suspend_always final_suspend() noexcept; |
| 35 |
void return_void(); |
| 36 |
[[noreturn]] void unhandled_exception(); |
| 37 |
|
| 38 |
static void* operator new(std::size_t size); |
| 39 |
static void operator delete(void* ptr, const std::size_t size); |
| 40 |
}; |
| 41 |
}; |
| 42 |
|
| 43 |
generator goo() { co_return; } |