Use `MRB_SYM()` for error class retrieval; ref
Note that `MRB_SYM()` is only available when `mruby/presym.h` is
included. Use `mrb_intern_lit()` otherwise.
MODIFY
include/mruby.h
include/mruby.h
@@ -1303,6 +1303,13 @@ MRB_API mrb_value mrb_vformat(mrb_state *mrb, const char *format, va_list ap);
+ those E_* macros requires mrb_state* variable named mrb.
+ exception objects obtained from those macros are local to mrb
*/
+#ifdef MRB_SYM
+/* mruby/presym.h is included earlier */
+# define MRB_E_SYM(sym) MRB_SYM(sym)
+#else
+# define MRB_E_SYM(sym) mrb_intern_lit(mrb, #sym)
+#endif
+
#define E_RUNTIME_ERROR mrb_exc_get_id(mrb, mrb_intern_lit(mrb, "RuntimeError"))
#define E_TYPE_ERROR mrb_exc_get_id(mrb, mrb_intern_lit(mrb, "TypeError"))
#define E_ZERODIV_ERROR mrb_exc_get_id(mrb, mrb_intern_lit(mrb, "ZeroDivisionError"))

MODIFY
include/mruby/presym/enable.h
include/mruby/presym/enable.h
@@ -38,4 +38,8 @@ enum mruby_presym {
static const mrb_sym name[] = {__VA_ARGS__}; \
static void init_##name(mrb_state *mrb) {}
+/* use MRB_SYM() for E_RUNTIME_ERROR etc. */
+# undef MRB_E_SYM
+# define MRB_E_SYM(sym) MRB_SYM(sym)
+
#endif /* MRUBY_PRESYM_ENABLE_H */

Use `MRB_SYM()` for error class retrieval; ref #5277

Note that `MRB_SYM()` is only available when `mruby/presym.h` is
included. Use `mrb_intern_lit()` otherwise.