summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaCoroutine.cpp
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2017-05-31 23:41:11 +0000
committerEric Fiselier <eric@efcs.ca>2017-05-31 23:41:11 +0000
commit84ee7ff741c758f8e4b1c3da48d1259e9895f385 (patch)
tree6f01c7267beabd1be1a371ebf8646dab8710d0e4 /clang/lib/Sema/SemaCoroutine.cpp
parentbaa9198585459a7f7987fd64c8555ce85669b871 (diff)
downloadbcm5719-llvm-84ee7ff741c758f8e4b1c3da48d1259e9895f385.tar.gz
bcm5719-llvm-84ee7ff741c758f8e4b1c3da48d1259e9895f385.zip
[coroutines] Fix checking for prvalue-ness of `await_suspend` return type
Summary: @rsmith Does this correctly address the issues mentioned in https://reviews.llvm.org/D33625#inline-292971 ? Reviewers: rsmith, EricWF Reviewed By: EricWF Subscribers: cfe-commits, rsmith Differential Revision: https://reviews.llvm.org/D33636 llvm-svn: 304373
Diffstat (limited to 'clang/lib/Sema/SemaCoroutine.cpp')
-rw-r--r--clang/lib/Sema/SemaCoroutine.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp
index f5594bd64d9..8a548c0ab86 100644
--- a/clang/lib/Sema/SemaCoroutine.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud