[coroutines] Make sure auto return type of await_resume is properly handled

Reviewers: rsmith, EricWF

Reviewed By: rsmith

Subscribers: javed.absar, cfe-commits

Differential Revision: https://reviews.llvm.org/D37454

llvm-svn: 312565
diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp
index ae8744c..e6b640f 100644
--- a/clang/lib/Sema/SemaCoroutine.cpp
+++ b/clang/lib/Sema/SemaCoroutine.cpp
@@ -438,14 +438,14 @@
     //   - await-suspend is the expression e.await_suspend(h), which shall be
     //     a prvalue of type void or bool.
     QualType RetType = AwaitSuspend->getCallReturnType(S.Context);
+
     // Experimental support for coroutine_handle returning await_suspend.
     if (Expr *TailCallSuspend = maybeTailCall(S, RetType, AwaitSuspend, Loc))
       Calls.Results[ACT::ACT_Suspend] = TailCallSuspend;
     else {
       // non-class prvalues always have cv-unqualified types
-      QualType AdjRetType = RetType.getUnqualifiedType();
       if (RetType->isReferenceType() ||
-          (AdjRetType != S.Context.BoolTy && AdjRetType != S.Context.VoidTy)) {
+          (!RetType->isBooleanType() && !RetType->isVoidType())) {
         S.Diag(AwaitSuspend->getCalleeDecl()->getLocation(),
                diag::err_await_suspend_invalid_return_type)
             << RetType;