Fixed #7147 (TemplateSimplifier: specialized template class with inheritance)
This commit is contained in:
parent
e03e9fbbcf
commit
8e79e5c1d3
|
@ -430,7 +430,7 @@ std::set<std::string> TemplateSimplifier::expandSpecialized(Token *tokens)
|
||||||
ostr << " ";
|
ostr << " ";
|
||||||
ostr << tok3->str();
|
ostr << tok3->str();
|
||||||
}
|
}
|
||||||
if (!Token::Match(tok3, "> (|{"))
|
if (!Token::Match(tok3, "> (|{|:"))
|
||||||
continue;
|
continue;
|
||||||
s = ostr.str();
|
s = ostr.str();
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,6 +101,8 @@ private:
|
||||||
TEST_CASE(templateParameters);
|
TEST_CASE(templateParameters);
|
||||||
|
|
||||||
TEST_CASE(templateNamePosition);
|
TEST_CASE(templateNamePosition);
|
||||||
|
|
||||||
|
TEST_CASE(expandSpecialized);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string tok(const char code[], bool simplify = true, bool debugwarnings = false, Settings::PlatformType type = Settings::Native) {
|
std::string tok(const char code[], bool simplify = true, bool debugwarnings = false, Settings::PlatformType type = Settings::Native) {
|
||||||
|
@ -1318,6 +1320,11 @@ private:
|
||||||
TODO_ASSERT_EQUALS(7, -1, templateNamePositionHelper("template<class T> class A { unsigned foo(); }; "
|
TODO_ASSERT_EQUALS(7, -1, templateNamePositionHelper("template<class T> class A { unsigned foo(); }; "
|
||||||
"template<class T> unsigned A<T>::foo() { return 0; }", 19));
|
"template<class T> unsigned A<T>::foo() { return 0; }", 19));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void expandSpecialized() {
|
||||||
|
ASSERT_EQUALS("class A<int> { } ;", tok("template<> class A<int> {};"));
|
||||||
|
ASSERT_EQUALS("class A<int> : public B { } ;", tok("template<> class A<int> : public B {};"));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
REGISTER_TEST(TestSimplifyTemplate)
|
REGISTER_TEST(TestSimplifyTemplate)
|
||||||
|
|
Loading…
Reference in New Issue