TemplateSimplifier: Fixed instantiation when template parameters are A<..>, B<..>
This commit is contained in:
parent
5804cc44e7
commit
4779f0e172
|
@ -2966,7 +2966,7 @@ std::string TemplateSimplifier::getNewName(
|
|||
++indentlevel;
|
||||
else if (indentlevel > 0 && Token::Match(tok3, "> ,|>|::"))
|
||||
--indentlevel;
|
||||
if (indentlevel == 0 && Token::Match(tok3->previous(), "[<,]")) {
|
||||
else if (indentlevel == 0 && Token::Match(tok3->previous(), "[<,]")) {
|
||||
mTypesUsedInTemplateInstantiation.emplace_back(tok3, "");
|
||||
}
|
||||
if (Token::Match(tok3, "(|["))
|
||||
|
|
|
@ -220,6 +220,7 @@ private:
|
|||
TEST_CASE(template174); // #10506 hang
|
||||
TEST_CASE(template175); // #10908
|
||||
TEST_CASE(template176); // #11146
|
||||
TEST_CASE(template177);
|
||||
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)
|
||||
|
@ -4491,6 +4492,16 @@ private:
|
|||
ASSERT_EQUALS(exp, tok(code));
|
||||
}
|
||||
|
||||
void template177() {
|
||||
const char code[] = "template <typename Encoding, typename Allocator>\n"
|
||||
"class C { xyz<Encoding, Allocator> x; };\n"
|
||||
"C<UTF8<>, MemoryPoolAllocator<>> c;";
|
||||
const char exp[] = "class C<UTF8<>,MemoryPoolAllocator<>> ; "
|
||||
"C<UTF8<>,MemoryPoolAllocator<>> c ; "
|
||||
"class C<UTF8<>,MemoryPoolAllocator<>> { xyz < UTF8 < > , MemoryPoolAllocator < > > x ; } ;";
|
||||
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