llvm-project/clang/test/SemaCXX/coroutine-dealloc.cpp
Chuanqi Xu f65f06d63f [NFC] [Coroutines] Add tests for looking up deallocation
According to [dcl.fct.def.coroutine]p12, the program should be
ill-formed if the promise_type contains operator delete but none of them
are available. But this behavior was not tested before. This commit adds
the tests for it.
2022-09-06 14:57:01 +08:00

28 lines
736 B
C++

// Tests that the behavior will be good if there are multiple operator delete in the promise_type.
// RUN: %clang_cc1 %s -std=c++20 %s -fsyntax-only -verify
// expected-no-diagnostics
#include "Inputs/std-coroutine.h"
namespace std {
typedef __SIZE_TYPE__ size_t;
enum class align_val_t : size_t {};
}
struct task {
struct promise_type {
auto initial_suspend() { return std::suspend_always{}; }
auto final_suspend() noexcept { return std::suspend_always{}; }
auto get_return_object() { return task{}; }
void unhandled_exception() {}
void return_value(int) {}
void operator delete(void *ptr, void *meaningless_placeholder);
void operator delete(void *ptr);
};
};
task f() {
co_return 43;
}