Author: ericwf
Date: Tue Apr 18 00:30:39 2017
New Revision: 300529

URL: http://llvm.org/viewvc/llvm-project?rev=300529&view=rev
Log:
Assert that a valid operator new/delete signature is always found by the 
coroutine body

Modified:
    cfe/trunk/lib/Sema/SemaCoroutine.cpp

Modified: cfe/trunk/lib/Sema/SemaCoroutine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCoroutine.cpp?rev=300529&r1=300528&r2=300529&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCoroutine.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCoroutine.cpp Tue Apr 18 00:30:39 2017
@@ -912,7 +912,9 @@ bool CoroutineStmtBuilder::makeNewAndDel
                               OperatorNew, UnusedResult);
   }
 
-  if (OperatorNew && RequiresNoThrowAlloc) {
+  assert(OperatorNew && "expected definition of operator new to be found");
+
+  if (RequiresNoThrowAlloc) {
     const auto *FT = OperatorNew->getType()->getAs<FunctionProtoType>();
     if (!FT->isNothrow(S.Context, /*ResultIfDependent*/ false)) {
       S.Diag(OperatorNew->getLocation(),
@@ -924,9 +926,6 @@ bool CoroutineStmtBuilder::makeNewAndDel
     }
   }
 
-  // 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;
 


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to