diff --git a/src/regex_impl.cc b/src/regex_impl.cc index 26bbcb7e..b8a656d2 100644 --- a/src/regex_impl.cc +++ b/src/regex_impl.cc @@ -812,19 +812,17 @@ CompiledRegex compile_regex(StringView re) } auto test_regex = UnitTest{[]{ - struct TestVM : ThreadedRegexVM + struct TestVM : CompiledRegex, ThreadedRegexVM { TestVM(StringView re, bool dump = false) - : ThreadedRegexVM{m_program}, - m_program{RegexCompiler::compile(re)} - { if (dump) dump_regex(m_program); } + : CompiledRegex{RegexCompiler::compile(re)}, + ThreadedRegexVM{(const CompiledRegex&)*this} + { if (dump) dump_regex(*this); } bool exec(StringView re, bool match = true, bool longest = false) { return ThreadedRegexVM::exec(re.begin(), re.end(), match, longest); } - - CompiledRegex m_program; }; {