Fixed #4767 (segmentation fault in expand template)

This commit is contained in:
Frank Zingsheim 2013-05-01 13:28:01 +02:00
parent 287782a679
commit 42068a3d60
2 changed files with 5 additions and 2 deletions

View File

@ -630,7 +630,7 @@ void TemplateSimplifier::expandTemplate(
std::list<Token *> &templateInstantiations)
{
for (const Token *tok3 = tokenlist.front(); tok3; tok3 = tok3->next()) {
if (tok3->str() == "{" || tok3->str() == "(")
if (tok3->str() == "{" || tok3->str() == "(" || tok3->str() == "[")
tok3 = tok3->link();
// Start of template..

View File

@ -1894,6 +1894,7 @@ private:
"{\n"
"public:\n"
" static AA<T> create(T* newObject);\n"
" static int size();\n"
"};\n"
"\n"
"class CC { public: CC(AA<BB>, int) {} };\n"
@ -1906,7 +1907,9 @@ private:
"\n"
"XX::XX():\n"
" y(AA<CC>::create(new CC(AA<BB>(), 0)))\n"
" {}\n";
" {}\n"
"\n"
"int yy[AA<CC>::size()];";
// Just run it and check that there are not assertions.
tok(code);