diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-06-01 20:58:49 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-06-01 20:58:49 +0000 |
| commit | 416ada0f75bab22b084a1776deb229cd4a669c4d (patch) | |
| tree | 6eb65f3790434471361628af6199b07a4de92de7 /lib/Sema/SemaCoroutine.cpp | |
| parent | 550ae89a710bf458d47e5b1d183f5e7039c2b384 (diff) | |
Diffstat (limited to 'lib/Sema/SemaCoroutine.cpp')
| -rw-r--r-- | lib/Sema/SemaCoroutine.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Sema/SemaCoroutine.cpp b/lib/Sema/SemaCoroutine.cpp index ae6c35f22065f..8a548c0ab861a 100644 --- a/lib/Sema/SemaCoroutine.cpp +++ b/lib/Sema/SemaCoroutine.cpp @@ -391,8 +391,11 @@ static ReadySuspendResumeResult buildCoawaitCalls(Sema &S, VarDecl *CoroPromise, // [expr.await]p3 [...] // - await-suspend is the expression e.await_suspend(h), which shall be // a prvalue of type void or bool. - QualType RetType = AwaitSuspend->getType(); - if (RetType != S.Context.BoolTy && RetType != S.Context.VoidTy) { + QualType RetType = AwaitSuspend->getCallReturnType(S.Context); + // non-class prvalues always have cv-unqualified types + QualType AdjRetType = RetType.getUnqualifiedType(); + if (RetType->isReferenceType() || + (AdjRetType != S.Context.BoolTy && AdjRetType != S.Context.VoidTy)) { S.Diag(AwaitSuspend->getCalleeDecl()->getLocation(), diag::err_await_suspend_invalid_return_type) << RetType; @@ -437,6 +440,7 @@ VarDecl *Sema::buildCoroutinePromise(SourceLocation Loc) { if (VD->isInvalidDecl()) return nullptr; ActOnUninitializedDecl(VD); + FD->addDecl(VD); assert(!VD->isInvalidDecl()); return VD; } |
