Fix crash in issue 9007 (#1878)
This commit is contained in:
parent
169510bd3a
commit
b863c18e1d
|
@ -2955,6 +2955,9 @@ void TemplateSimplifier::replaceTemplateUsage(
|
|||
}
|
||||
}
|
||||
}
|
||||
// Fix crash in #9007
|
||||
if (Token::simpleMatch(nameTok->previous(), ">"))
|
||||
mTemplateNamePos.erase(nameTok->previous());
|
||||
removeTokens.emplace_back(nameTok, tok2->next());
|
||||
}
|
||||
|
||||
|
|
|
@ -461,6 +461,7 @@ private:
|
|||
|
||||
// #9052
|
||||
TEST_CASE(noCrash1);
|
||||
TEST_CASE(noCrash2);
|
||||
|
||||
// --check-config
|
||||
TEST_CASE(checkConfiguration);
|
||||
|
@ -7813,6 +7814,23 @@ private:
|
|||
"A::A( const std::string &name ) { return; }\n"))
|
||||
}
|
||||
|
||||
// #9007
|
||||
void noCrash2() {
|
||||
ASSERT_NO_THROW(tokenizeAndStringify(
|
||||
"class a {\n"
|
||||
"public:\n"
|
||||
" enum b {};\n"
|
||||
"};\n"
|
||||
"struct c;\n"
|
||||
"template <class> class d {\n"
|
||||
" d(const int &, a::b, double, double);\n"
|
||||
" d(const d &);\n"
|
||||
"};\n"
|
||||
"template <> d<int>::d(const int &, a::b, double, double);\n"
|
||||
"template <> d<int>::d(const d &) {}\n"
|
||||
"template <> d<c>::d(const d &) {}\n"))
|
||||
}
|
||||
|
||||
void checkConfig(const char code[]) {
|
||||
errout.str("");
|
||||
|
||||
|
|
Loading…
Reference in New Issue