Fix template instantialion failure for qualified template type. (#1237)
This commit is contained in:
parent
748f50cf85
commit
d567b878ba
|
@ -1571,7 +1571,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
|
|||
typeForNewName.clear();
|
||||
break;
|
||||
}
|
||||
if (Token::Match(tok3->tokAt(-2), "[<,] %name% <") && templateParameters(tok3) > 0)
|
||||
if (Token::Match(tok3->tokAt(-2), "<|,|:: %name% <") && templateParameters(tok3) > 0)
|
||||
++indentlevel;
|
||||
else if (indentlevel > 0 && Token::Match(tok3, "> [,>]"))
|
||||
--indentlevel;
|
||||
|
|
|
@ -100,6 +100,7 @@ private:
|
|||
TEST_CASE(template60); // handling of methods outside template definition
|
||||
TEST_CASE(template61); // daca2, kodi
|
||||
TEST_CASE(template62); // #8314 - inner template instantiation
|
||||
TEST_CASE(template63); // #8576 - qualified type
|
||||
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)
|
||||
|
@ -1145,6 +1146,12 @@ private:
|
|||
ASSERT_EQUALS(exp, tok(code));
|
||||
}
|
||||
|
||||
void template63() { // #8576
|
||||
const char code[] = "template<class T> struct TestClass { T m_hi; }; TestClass<std::auto_ptr<v>> objTest3;";
|
||||
const char exp[] = "TestClass<std::auto_ptr<v>> objTest3 ; struct TestClass<std::auto_ptr<v>> { std :: auto_ptr < v > m_hi ; } ;";
|
||||
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