view gcc/testsuite/g++.dg/coroutines/coro-missing-promise.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
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;
}