Fixed handling of pointers in templates (#4319)
This commit is contained in:
parent
66627e0608
commit
9cb9388e49
|
@ -225,6 +225,7 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok)
|
||||||
|
|
||||||
if (!tok)
|
if (!tok)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// ,/>
|
// ,/>
|
||||||
while (tok->str() == ">" || tok->str() == ">>") {
|
while (tok->str() == ">" || tok->str() == ">>") {
|
||||||
if (level == 0)
|
if (level == 0)
|
||||||
|
@ -236,9 +237,15 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok)
|
||||||
--level;
|
--level;
|
||||||
}
|
}
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
|
||||||
|
// * / &
|
||||||
|
while (Token::Match(tok, "[*&]"))
|
||||||
|
tok = tok->next();
|
||||||
|
|
||||||
if (!tok)
|
if (!tok)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok->str() != ",")
|
if (tok->str() != ",")
|
||||||
continue;
|
continue;
|
||||||
if (level == 0)
|
if (level == 0)
|
||||||
|
|
|
@ -259,6 +259,7 @@ private:
|
||||||
TEST_CASE(varid_using); // ticket #3648
|
TEST_CASE(varid_using); // ticket #3648
|
||||||
TEST_CASE(varid_catch);
|
TEST_CASE(varid_catch);
|
||||||
TEST_CASE(varid_functionPrototypeTemplate);
|
TEST_CASE(varid_functionPrototypeTemplate);
|
||||||
|
TEST_CASE(varid_templatePtr); // #4319
|
||||||
|
|
||||||
TEST_CASE(varidclass1);
|
TEST_CASE(varidclass1);
|
||||||
TEST_CASE(varidclass2);
|
TEST_CASE(varidclass2);
|
||||||
|
@ -4057,6 +4058,11 @@ private:
|
||||||
"1: function < void ( ) > fptr@1 ;\n", tokenizeDebugListing("function<void(void)> fptr;"));
|
"1: function < void ( ) > fptr@1 ;\n", tokenizeDebugListing("function<void(void)> fptr;"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void varid_templatePtr() {
|
||||||
|
ASSERT_EQUALS("\n\n##file 0\n"
|
||||||
|
"1: std :: map < int , FooTemplate < int > * > dummy_member@1 [ 1 ] ;\n", tokenizeDebugListing("std::map<int, FooTemplate<int>*> dummy_member[1];"));
|
||||||
|
}
|
||||||
|
|
||||||
void varidclass1() {
|
void varidclass1() {
|
||||||
const std::string actual = tokenizeDebugListing(
|
const std::string actual = tokenizeDebugListing(
|
||||||
"class Fred\n"
|
"class Fred\n"
|
||||||
|
|
Loading…
Reference in New Issue