From 66b09dfc4f3e89b2b2ea16ed3c64a9251f2fdc2f Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 16 Oct 2007 05:06:30 +0000 Subject: * re.c (rb_reg_s_union): encoding of all regexp objects should match. [ruby-dev:32076] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- re.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 're.c') diff --git a/re.c b/re.c index 78a72f277..1d3e144cf 100644 --- a/re.c +++ b/re.c @@ -1997,6 +1997,7 @@ static VALUE rb_reg_s_union(VALUE self, VALUE args0) { long argc = RARRAY_LEN(args0); + if (argc == 0) { VALUE args[1]; args[0] = rb_str_new2("(?!)"); @@ -2018,11 +2019,14 @@ rb_reg_s_union(VALUE self, VALUE args0) VALUE kcode_re = Qnil; VALUE source = rb_str_buf_new(0); VALUE args[3]; + VALUE tmp = rb_ary_entry(args0, 0); + for (i = 0; i < argc; i++) { volatile VALUE v; if (0 < i) rb_str_buf_cat2(source, "|"); v = rb_check_regexp_type(rb_ary_entry(args0, i)); + rb_enc_check(tmp, v); if (!NIL_P(v)) { if (FL_TEST(v, KCODE_FIXED)) { if (kcode == -1) { -- cgit