Index: lib/Sema/SemaCoroutine.cpp =================================================================== --- lib/Sema/SemaCoroutine.cpp +++ lib/Sema/SemaCoroutine.cpp @@ -1526,8 +1526,8 @@ auto *FD = cast(CurContext); auto *ScopeInfo = getCurFunction(); - assert(ScopeInfo->CoroutineParameterMoves.empty() && - "Should not build parameter moves twice"); + if (!ScopeInfo->CoroutineParameterMoves.empty()) + return false; for (auto *PD : FD->parameters()) { if (PD->getType()->isDependentType()) Index: test/SemaCXX/coroutines.cpp =================================================================== --- test/SemaCXX/coroutines.cpp +++ test/SemaCXX/coroutines.cpp @@ -87,6 +87,11 @@ co_await a; } +int no_promise_type_2(int a) { // expected-error {{this function cannot be a coroutine: 'std::experimental::coroutine_traits' has no member named 'promise_type'}} + co_await a; + co_await a; +} + template <> struct std::experimental::coroutine_traits { typedef int promise_type; }; double bad_promise_type(double) { // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits::promise_type' (aka 'int') is not a class}}