throw.h: avoid using static member in C++ struct; fix #5846

The initialization causes linkage error with gcc (not clang), caused by
the following gcc bug:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86254
This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-10-31 16:18:15 +09:00
parent ab0a7f0583
commit 37fac6c089
2 changed files with 6 additions and 5 deletions
+5 -4
View File
@@ -52,14 +52,15 @@ typedef mrb_int mrb_jmpbuf_impl;
#endif
#if defined(MRB_USE_CXX_EXCEPTION)
extern mrb_int mrb_jmpbuf_id;
#endif
struct mrb_jmpbuf {
mrb_jmpbuf_impl impl;
#if defined(MRB_USE_CXX_EXCEPTION)
static mrb_int jmpbuf_id;
# if defined(__cplusplus)
mrb_jmpbuf() : impl(jmpbuf_id++) {}
# endif
mrb_jmpbuf() : impl(mrb_jmpbuf_id++) {}
#endif
};
+1 -1
View File
@@ -3127,5 +3127,5 @@ mrb_top_run(mrb_state *mrb, const struct RProc *proc, mrb_value self, mrb_int st
# if !defined(MRB_USE_CXX_ABI)
} /* end of extern "C" */
# endif
mrb_int mrb_jmpbuf::jmpbuf_id = 0;
mrb_int mrb_jmpbuf_id = 0;
#endif