Fix daca dnsdist crash (#2053)
This commit is contained in:
parent
e58e51ee14
commit
9436f72a94
|
@ -2834,6 +2834,10 @@ std::string TemplateSimplifier::getNewName(
|
||||||
if (indentlevel == 0 && Token::Match(tok3->previous(), "[<,]")) {
|
if (indentlevel == 0 && Token::Match(tok3->previous(), "[<,]")) {
|
||||||
mTypesUsedInTemplateInstantiation.emplace_back(tok3, "");
|
mTypesUsedInTemplateInstantiation.emplace_back(tok3, "");
|
||||||
}
|
}
|
||||||
|
if (tok3->str() == "(")
|
||||||
|
++indentlevel;
|
||||||
|
else if (tok3->str() == ")")
|
||||||
|
--indentlevel;
|
||||||
const bool constconst = tok3->str() == "const" && tok3->strAt(1) == "const";
|
const bool constconst = tok3->str() == "const" && tok3->strAt(1) == "const";
|
||||||
if (!constconst) {
|
if (!constconst) {
|
||||||
typeStringsUsedInTemplateInstantiation.push_back(tok3->str());
|
typeStringsUsedInTemplateInstantiation.push_back(tok3->str());
|
||||||
|
|
|
@ -166,6 +166,7 @@ private:
|
||||||
TEST_CASE(template126); // #9217
|
TEST_CASE(template126); // #9217
|
||||||
TEST_CASE(template127); // #9225
|
TEST_CASE(template127); // #9225
|
||||||
TEST_CASE(template128); // #9224
|
TEST_CASE(template128); // #9224
|
||||||
|
TEST_CASE(template129);
|
||||||
TEST_CASE(template_specialization_1); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
|
TEST_CASE(template_specialization_1); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
|
||||||
TEST_CASE(template_specialization_2); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
|
TEST_CASE(template_specialization_2); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
|
||||||
TEST_CASE(template_enum); // #6299 Syntax error in complex enum declaration (including template)
|
TEST_CASE(template_enum); // #6299 Syntax error in complex enum declaration (including template)
|
||||||
|
@ -3049,6 +3050,26 @@ private:
|
||||||
ASSERT_EQUALS(exp, tok(code));
|
ASSERT_EQUALS(exp, tok(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void template129() {
|
||||||
|
const char code[] = "class LuaContext {\n"
|
||||||
|
"public:\n"
|
||||||
|
" template <typename TFunctionType, typename TType>\n"
|
||||||
|
" void registerFunction(TType fn) { }\n"
|
||||||
|
"};\n"
|
||||||
|
"void setupLuaBindingsDNSQuestion() {\n"
|
||||||
|
" g_lua.registerFunction<void (DNSQuestion ::*)(std ::string, std ::string)>();\n"
|
||||||
|
"}";
|
||||||
|
const char exp[] = "class LuaContext { "
|
||||||
|
"public: "
|
||||||
|
"template < typename TFunctionType , typename TType > "
|
||||||
|
"void registerFunction ( TType fn ) { } "
|
||||||
|
"} ; "
|
||||||
|
"void setupLuaBindingsDNSQuestion ( ) { "
|
||||||
|
"g_lua . registerFunction < void ( DNSQuestion :: * ) ( std :: string , std :: string ) > ( ) ; "
|
||||||
|
"}";
|
||||||
|
ASSERT_EQUALS(exp, tok(code));
|
||||||
|
}
|
||||||
|
|
||||||
void template_specialization_1() { // #7868 - template specialization template <typename T> struct S<C<T>> {..};
|
void template_specialization_1() { // #7868 - template specialization template <typename T> struct S<C<T>> {..};
|
||||||
const char code[] = "template <typename T> struct C {};\n"
|
const char code[] = "template <typename T> struct C {};\n"
|
||||||
"template <typename T> struct S {a};\n"
|
"template <typename T> struct S {a};\n"
|
||||||
|
|
Loading…
Reference in New Issue