parent
f02636e995
commit
2da83df37b
|
@ -1221,7 +1221,7 @@ void TemplateSimplifier::simplifyTemplateAliases()
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (!tok2 || tok2->str() != ">" || args.size() != aliasParameters.size()) {
|
||||
if (!tok2 || tok2->str() != ">" || (!aliasDeclaration.isVariadic() && (args.size() != aliasParameters.size()))) {
|
||||
++it2;
|
||||
continue;
|
||||
}
|
||||
|
@ -1597,6 +1597,10 @@ void TemplateSimplifier::expandTemplate(
|
|||
++typeindentlevel;
|
||||
else if (typeindentlevel > 0 && typetok->str() == ">")
|
||||
--typeindentlevel;
|
||||
else if (typetok->str() == "(")
|
||||
++typeindentlevel;
|
||||
else if (typetok->str() == ")")
|
||||
--typeindentlevel;
|
||||
dst->insertToken(typetok->str(), typetok->originalName(), true);
|
||||
Token *previous = dst->previous();
|
||||
previous->isTemplateArg(true);
|
||||
|
@ -1818,6 +1822,10 @@ void TemplateSimplifier::expandTemplate(
|
|||
++typeindentlevel;
|
||||
else if (typeindentlevel > 0 && typetok->str() == ">")
|
||||
--typeindentlevel;
|
||||
else if (typetok->str() == "(")
|
||||
++typeindentlevel;
|
||||
else if (typetok->str() == ")")
|
||||
--typeindentlevel;
|
||||
mTokenList.addtoken(typetok, tok5->linenr(), tok5->fileIndex());
|
||||
Token *back = mTokenList.back();
|
||||
if (Token::Match(back, "{|(|[")) {
|
||||
|
@ -1918,6 +1926,10 @@ void TemplateSimplifier::expandTemplate(
|
|||
++typeindentlevel;
|
||||
else if (typeindentlevel > 0 && typetok->str() == ">")
|
||||
--typeindentlevel;
|
||||
else if (typetok->str() == "(")
|
||||
++typeindentlevel;
|
||||
else if (typetok->str() == ")")
|
||||
--typeindentlevel;
|
||||
if (copy) {
|
||||
mTokenList.addtoken(typetok, tok3->linenr(), tok3->fileIndex());
|
||||
Token *back = mTokenList.back();
|
||||
|
@ -2992,6 +3004,10 @@ void TemplateSimplifier::replaceTemplateUsage(
|
|||
while (tok2 != endToken && (indentlevel2 > 0 || tok2->str() != ">")) {
|
||||
if (tok2->str() == "<" && (tok2->strAt(1) == ">" || templateParameters(tok2)))
|
||||
++indentlevel2;
|
||||
else if (tok2->str() == "(")
|
||||
++indentlevel2;
|
||||
else if (tok2->str() == ")")
|
||||
--indentlevel2;
|
||||
else if (indentlevel2 > 0 && Token::Match(tok2, "> [,>]"))
|
||||
--indentlevel2;
|
||||
else if (indentlevel2 == 0) {
|
||||
|
|
|
@ -167,6 +167,7 @@ private:
|
|||
TEST_CASE(template127); // #9225
|
||||
TEST_CASE(template128); // #9224
|
||||
TEST_CASE(template129);
|
||||
TEST_CASE(template130); // #9246
|
||||
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_enum); // #6299 Syntax error in complex enum declaration (including template)
|
||||
|
@ -3087,6 +3088,19 @@ private:
|
|||
ASSERT_EQUALS(exp, tok(code));
|
||||
}
|
||||
|
||||
void template130() { // #9246
|
||||
const char code[] = "template <typename...> using a = int;\n"
|
||||
"template <typename, typename> using b = a<>;\n"
|
||||
"template <typename, typename> void c();\n"
|
||||
"template <typename d, typename> void e() { c<b<d, int>, int>; }\n"
|
||||
"void f() { e<int(int, ...), int>(); }";
|
||||
const char exp[] = "template < typename , typename > void c ( ) ; "
|
||||
"void e<int(int,...),int> ( ) ; "
|
||||
"void f ( ) { e<int(int,...),int> ( ) ; } "
|
||||
"void e<int(int,...),int> ( ) { c < int , int > ; }";
|
||||
ASSERT_EQUALS(exp, tok(code));
|
||||
}
|
||||
|
||||
void template_specialization_1() { // #7868 - template specialization template <typename T> struct S<C<T>> {..};
|
||||
const char code[] = "template <typename T> struct C {};\n"
|
||||
"template <typename T> struct S {a};\n"
|
||||
|
|
Loading…
Reference in New Issue