about summary refs log tree commit diff stats
path: root/034address.cc
diff options
context:
space:
mode:
Diffstat (limited to '034address.cc')
-rw-r--r--034address.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/034address.cc b/034address.cc
index d2166135..d1977bd2 100644
--- a/034address.cc
+++ b/034address.cc
@@ -160,6 +160,10 @@ case NEW: {
     raise << maybe(caller.name) << "first ingredient of 'new' should be a type, but got '" << type.original_string << "'\n" << end();
     break;
   }
+  if (SIZE(inst.ingredients) > 1 && !is_mu_number(inst.ingredients.at(1))) {
+    raise << maybe(caller.name) << "second ingredient of 'new' should be a number (array length), but got '" << type.original_string << "'\n" << end();
+    break;
+  }
   if (inst.products.empty()) {
     raise << maybe(caller.name) << "result of 'new' should never be ignored\n" << end();
     break;