summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/re.c b/re.c
index f2ac99f9ff..4e909ebded 100644
--- a/re.c
+++ b/re.c
@@ -1506,6 +1506,7 @@ rb_reg_regcomp(str)
case_cache = ruby_ignorecase;
kcode_cache = reg_kcode;
reg_cache = rb_reg_new(RSTRING(str)->ptr, RSTRING(str)->len, ruby_ignorecase);
+ OBJ_INFECT(reg_cache, str);
RB_GC_GUARD(save_str);
return reg_cache;
}