From ab61e5c932c96acd56d22c898bf67d960c1bb677 Mon Sep 17 00:00:00 2001 From: nagachika Date: Mon, 15 Aug 2016 19:24:47 +0000 Subject: merge revision(s) 55562: [Backport #12454] * regcomp.c (noname_disable_map): don't optimize out group 0 Ruby's Regexp doesn't allow normal numbered groups if the regexp has named groups. On such case it optimizes out related NT_ENCLOSE. But even on the case it can use \g<0>. This fix not to remove NT_ENCLOSE whose regnum is 0. [ruby-core:75828] [Bug #12454] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_regexp.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'test/ruby') diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index dce5792954..bd10ad5395 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -391,6 +391,7 @@ class TestRegexp < Test::Unit::TestCase assert_raise(RegexpError) { Regexp.new(")(") } assert_raise(RegexpError) { Regexp.new('[\\40000000000') } assert_raise(RegexpError) { Regexp.new('[\\600000000000.') } + assert_raise(RegexpError) { Regexp.new("((?))\\g<0>") } end def test_unescape -- cgit v1.2.3