From 1e6442f54e5d0b003181973155e20b820d8a9c63 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Mon, 10 Mar 2025 19:33:49 +0900 Subject: [PATCH] Revert "class.c (include_module_at): narrow local variable scope" C++ does not compile `goto` cross local variable declaration. This reverts commit c618b44feecaa7c611fa62a82892af1e1d8ba8d8. --- src/class.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/class.c b/src/class.c index 1ad243fd2..1c1986744 100644 --- a/src/class.c +++ b/src/class.c @@ -1464,6 +1464,7 @@ include_class_new(mrb_state *mrb, struct RClass *m, struct RClass *super) static int include_module_at(mrb_state *mrb, struct RClass *c, struct RClass *ins_pos, struct RClass *m, int search_super) { + struct RClass *ic; void *klass_mt = find_origin(c)->mt; while (m) { @@ -1494,7 +1495,7 @@ include_module_at(mrb_state *mrb, struct RClass *c, struct RClass *ins_pos, stru p = p->super; } - struct RClass *ic = include_class_new(mrb, m, ins_pos->super); + ic = include_class_new(mrb, m, ins_pos->super); m->flags |= MRB_FL_CLASS_IS_INHERITED; ins_pos->super = ic; mrb_field_write_barrier(mrb, (struct RBasic*)ins_pos, (struct RBasic*)ic);