brintos

brintos / llvm-project-archived public Read only

0
0
Text · 878 B · a5727d6 Raw
27 lines · cpp
1// Test that if the compiler will emit error message if the promise_type contain2// operator delete but none of them are available. This is required by the standard.3// RUN: %clang_cc1 %s -std=c++20 %s -fsyntax-only -verify4 5#include "Inputs/std-coroutine.h"6 7namespace std {8    typedef __SIZE_TYPE__ size_t;9    enum class align_val_t : size_t {};10}11 12struct 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); // expected-note {{member 'operator delete' declared here}}21  };22};23 24task f() { // expected-error 1+{{no suitable member 'operator delete' in 'promise_type'}}25  co_return 43;26}27