From 621cf6e7770d55f7f1902a6d3666e9b3a2478076 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Tue, 31 Dec 2013 13:59:32 +0100 Subject: [PATCH] Support arrays as template parameters in TemplateSimplifier::templateParameters --- lib/templatesimplifier.cpp | 2 +- test/testtokenize.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index b8b5114ec..54462f93c 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -263,7 +263,7 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok) return 0; // Function pointer or prototype.. - while (tok && tok->str() == "(") + while (tok && (tok->str() == "(" || tok->str() == "[")) tok = tok->link()->next(); if (!tok) return 0; diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 21c529a00..594ae1828 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -289,6 +289,7 @@ private: TEST_CASE(varid_functionPrototypeTemplate); TEST_CASE(varid_templatePtr); // #4319 TEST_CASE(varid_templateNamespaceFuncPtr); // #4172 + TEST_CASE(varid_templateArray); TEST_CASE(varid_variadicFunc); TEST_CASE(varid_typename); // #4644 TEST_CASE(varid_rvalueref); @@ -4564,6 +4565,12 @@ private: "1: KeyListT < float , & NIFFile :: getFloat > mKeyList@1 [ 4 ] ;\n", tokenizeDebugListing("KeyListT 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 attrPos = m_AttributePos.GetIterator();")); + } + void varid_variadicFunc() { ASSERT_EQUALS("\n\n##file 0\n" "1: int foo ( . . . ) ;\n", tokenizeDebugListing("int foo(...);"));