changeset 33244:08ab46f6e241

replace uses of assert with panic_impossible in ov.h * ov.h: Include panic.h. (octave_value_extract): Replace assert with panic_impossible.
author John W. Eaton <jwe@octave.org>
date Sat, 23 Mar 2024 13:22:58 -0400
parents d9ed1a322311
children 399be7cc310f
files libinterp/octave-value/ov.h
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov.h	Sat Mar 23 13:17:02 2024 -0400
+++ b/libinterp/octave-value/ov.h	Sat Mar 23 13:22:58 2024 -0400
@@ -36,6 +36,8 @@
 #include <memory>
 #include <map>
 
+#include "panic.h"
+
 #include "data-conv.h"
 #include "idx-vector.h"
 #include "mach-info.h"
@@ -1697,11 +1699,10 @@
 extern OCTINTERP_API void install_types (octave::type_info&);
 
 // Templated value extractors.
-// FIXME: would be more consistent to use panic_impossible(), rather than
-//        assert(), but including "error.h" leads to compilation errors.
+
 template <typename Value>
 inline Value octave_value_extract (const octave_value&)
-{ assert (false); }
+{ panic_impossible (); }
 
 #define DEF_VALUE_EXTRACTOR(VALUE,MPREFIX)                              \
   template <>                                                           \
@@ -1772,7 +1773,7 @@
   template <>                                                           \
   inline VALUE octave_value_extract<VALUE> (const octave_value&)        \
   {                                                                     \
-    assert (false);                                                     \
+    panic_impossible ();                                                \
     return DEFVAL;                                                      \
   }