Support arrays as template parameters in TemplateSimplifier::templateParameters

This commit is contained in:
PKEuS 2013-12-31 13:59:32 +01:00
parent 6f76dfcb22
commit 621cf6e777
2 changed files with 8 additions and 1 deletions

View File

@ -263,7 +263,7 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok)
return 0; return 0;
// Function pointer or prototype.. // Function pointer or prototype..
while (tok && tok->str() == "(") while (tok && (tok->str() == "(" || tok->str() == "["))
tok = tok->link()->next(); tok = tok->link()->next();
if (!tok) if (!tok)
return 0; return 0;

View File

@ -289,6 +289,7 @@ private:
TEST_CASE(varid_functionPrototypeTemplate); TEST_CASE(varid_functionPrototypeTemplate);
TEST_CASE(varid_templatePtr); // #4319 TEST_CASE(varid_templatePtr); // #4319
TEST_CASE(varid_templateNamespaceFuncPtr); // #4172 TEST_CASE(varid_templateNamespaceFuncPtr); // #4172
TEST_CASE(varid_templateArray);
TEST_CASE(varid_variadicFunc); TEST_CASE(varid_variadicFunc);
TEST_CASE(varid_typename); // #4644 TEST_CASE(varid_typename); // #4644
TEST_CASE(varid_rvalueref); TEST_CASE(varid_rvalueref);
@ -4564,6 +4565,12 @@ private:
"1: KeyListT < float , & NIFFile :: getFloat > mKeyList@1 [ 4 ] ;\n", tokenizeDebugListing("KeyListT<float, &NIFFile::getFloat> mKeyList[4];")); "1: KeyListT < float , & NIFFile :: getFloat > mKeyList@1 [ 4 ] ;\n", tokenizeDebugListing("KeyListT<float, &NIFFile::getFloat> mKeyList[4];"));
} }
void varid_templateArray() {
ASSERT_EQUALS("\n\n##file 0\n"
"1: VertexArrayIterator < float [ 2 ] > attrPos@1 ; attrPos@1 = m_AttributePos . GetIterator < float [ 2 ] > ( ) ;\n",
tokenizeDebugListing("VertexArrayIterator<float[2]> attrPos = m_AttributePos.GetIterator<float[2]>();"));
}
void varid_variadicFunc() { void varid_variadicFunc() {
ASSERT_EQUALS("\n\n##file 0\n" ASSERT_EQUALS("\n\n##file 0\n"
"1: int foo ( . . . ) ;\n", tokenizeDebugListing("int foo(...);")); "1: int foo ( . . . ) ;\n", tokenizeDebugListing("int foo(...);"));