view gcc/testsuite/g++.dg/coroutines/coro-missing-promise.C @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 1830386684a0
children
line wrap: on
line source

//  { dg-additional-options "-fsyntax-only -w" }

#include "coro.h"

// Diagnose completely missing promise.

// { dg-error {no type named 'promise_type' in 'struct NoPromiseHere'} "" { target *-*-* } 0 }

struct NoPromiseHere {
  coro::coroutine_handle<> handle;
  NoPromiseHere () : handle (nullptr) {}
  NoPromiseHere (coro::coroutine_handle<> handle) : handle (handle) {}
};

NoPromiseHere
bar ()
{
  co_yield 22; // { dg-error {unable to find the promise type for this coroutine} }
  co_return 0;
}