Fixed #4172 (TemplateSimplifier: Handle 'A<&f> x' template instantiation)
This commit is contained in:
parent
3905f4ad7d
commit
c3cb6202ed
|
@ -187,6 +187,10 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok)
|
||||||
if (Token::Match(tok, "struct|union"))
|
if (Token::Match(tok, "struct|union"))
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
|
||||||
|
// Skip '&'
|
||||||
|
if (Token::Match(tok, "& %var% [,>]"))
|
||||||
|
tok = tok->next();
|
||||||
|
|
||||||
// skip std::
|
// skip std::
|
||||||
if (tok && tok->str() == "::")
|
if (tok && tok->str() == "::")
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
|
|
@ -227,6 +227,7 @@ private:
|
||||||
TEST_CASE(varid50); // #3760 - explicit
|
TEST_CASE(varid50); // #3760 - explicit
|
||||||
TEST_CASE(varid51); // don't set varid for template function
|
TEST_CASE(varid51); // don't set varid for template function
|
||||||
TEST_CASE(varid52); // Set varid for nested templates
|
TEST_CASE(varid52); // Set varid for nested templates
|
||||||
|
TEST_CASE(varid53); // #4172 - Template instanciation: T<&functionName> list[4];
|
||||||
TEST_CASE(varid_cpp_keywords_in_c_code);
|
TEST_CASE(varid_cpp_keywords_in_c_code);
|
||||||
TEST_CASE(varidFunctionCall1);
|
TEST_CASE(varidFunctionCall1);
|
||||||
TEST_CASE(varidFunctionCall2);
|
TEST_CASE(varidFunctionCall2);
|
||||||
|
@ -3412,6 +3413,12 @@ private:
|
||||||
tokenizeDebugListing(code, false, "test.cpp"));
|
tokenizeDebugListing(code, false, "test.cpp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void varid53() { // #4172 - Template instanciation: T<&functionName> list[4];
|
||||||
|
ASSERT_EQUALS("\n\n##file 0\n"
|
||||||
|
"1: A < & f > list@1 [ 4 ] ;\n",
|
||||||
|
tokenizeDebugListing("A<&f> list[4];", false, "test.cpp"));
|
||||||
|
}
|
||||||
|
|
||||||
void varid_cpp_keywords_in_c_code() {
|
void varid_cpp_keywords_in_c_code() {
|
||||||
const char code[] = "void f() {\n"
|
const char code[] = "void f() {\n"
|
||||||
" delete d;\n"
|
" delete d;\n"
|
||||||
|
|
Loading…
Reference in New Issue