summaryrefslogtreecommitdiff
path: root/src/regex_impl.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-10-02 16:50:41 +0800
committerMaxime Coste <mawww@kakoune.org>2017-11-01 14:05:14 +0800
commit630d078b6dc3cd51a5cd3dbd76bfbaca065d30ae (patch)
treeba398a0d881bf7612a7fe069fbc7c6d5535a8f33 /src/regex_impl.cc
parent5b0c2cbdc2c15d3845dd9cd3799ea0282b65ba94 (diff)
Regex: Fix use of not-yet-constructed CompiledRegex in TestVM impl
Diffstat (limited to 'src/regex_impl.cc')
-rw-r--r--src/regex_impl.cc10
1 files changed, 4 insertions, 6 deletions
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<const char*>
+ struct TestVM : CompiledRegex, ThreadedRegexVM<const char*>
{
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;
};
{