Merge pull request #149 from simartin/ticked_4742_testcase

Testcase for ticked 4742 (cppcheck hangs on template code)
This commit is contained in:
Daniel Marjamäki 2013-07-07 01:19:23 -07:00
commit da52f7d367
1 changed files with 12 additions and 0 deletions

View File

@ -131,6 +131,7 @@ private:
TEST_CASE(template36); // #4310 - passing unknown template instantiation as template argument TEST_CASE(template36); // #4310 - passing unknown template instantiation as template argument
TEST_CASE(template37); // #4544 - A<class B> a; TEST_CASE(template37); // #4544 - A<class B> a;
TEST_CASE(template38); // #4832 - crash on C++11 right angle brackets TEST_CASE(template38); // #4832 - crash on C++11 right angle brackets
TEST_CASE(template39); // #4742 - freeze
TEST_CASE(template_unhandled); TEST_CASE(template_unhandled);
TEST_CASE(template_default_parameter); TEST_CASE(template_default_parameter);
TEST_CASE(template_default_type); TEST_CASE(template_default_type);
@ -2308,6 +2309,17 @@ private:
tok(code); // Don't crash or freeze tok(code); // Don't crash or freeze
} }
void template39() { // #4742 - Used to freeze in 1.60
const char code[] = "template<typename T> struct vector {"
" operator T() const;"
"};"
"void f() {"
" vector<vector<int>> v;"
" const vector<int> vi = static_cast<vector<int>>(v);"
"}";
tok(code);
}
void template_default_parameter() { void template_default_parameter() {
{ {
const char code[] = "template <class T, int n=3>\n" const char code[] = "template <class T, int n=3>\n"