================
@@ -3490,7 +3490,15 @@ inline bool AllocN(InterpState &S, CodePtr OpPC, 
PrimType T, const Expr *Source,
     S.Stk.push<Pointer>(0, nullptr);
     return true;
   }
-  assert(NumElements.isPositive());
+  if (!NumElements.isPositive()) {
+    if (!IsNoThrow) {
+      S.FFDiag(Source, diag::note_constexpr_new_negative)
----------------
tbaederr wrote:

```suggestion
      S.FFDiag(S.Current->getSource(OpPC), diag::note_constexpr_new_negative)
```

https://github.com/llvm/llvm-project/pull/155737
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to