From a3307a12a12cf6e61c16b7d3076e6cf7953bd84f Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Tue, 18 Apr 2017 05:30:39 +0000 Subject: [PATCH] Assert that a valid operator new/delete signature is always found by the coroutine body git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300529 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaCoroutine.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/Sema/SemaCoroutine.cpp b/lib/Sema/SemaCoroutine.cpp index 6d8f4fac01..c709a1a723 100644 --- a/lib/Sema/SemaCoroutine.cpp +++ b/lib/Sema/SemaCoroutine.cpp @@ -912,7 +912,9 @@ bool CoroutineStmtBuilder::makeNewAndDeleteExpr() { OperatorNew, UnusedResult); } - if (OperatorNew && RequiresNoThrowAlloc) { + assert(OperatorNew && "expected definition of operator new to be found"); + + if (RequiresNoThrowAlloc) { const auto *FT = OperatorNew->getType()->getAs(); if (!FT->isNothrow(S.Context, /*ResultIfDependent*/ false)) { S.Diag(OperatorNew->getLocation(), @@ -924,9 +926,6 @@ bool CoroutineStmtBuilder::makeNewAndDeleteExpr() { } } - // FIXME: Diagnose and handle the case where no matching operator new is found - // (ie OperatorNew == nullptr) - if ((OperatorDelete = findDeleteForPromise(S, Loc, PromiseType)) == nullptr) return false; -- 2.50.1