Fixed #3279 (Token::Match called with varid 0)
This commit is contained in:
parent
af7bf5c805
commit
0884204c2f
|
@ -3480,7 +3480,7 @@ void Tokenizer::setVarId()
|
|||
std::string varname;
|
||||
Token *tok2 = tok ? tok->next() : 0;
|
||||
while (tok2) {
|
||||
if (tok2->isName())
|
||||
if (tok2->isName() && tok2->str() != "const")
|
||||
varname = tok2->str();
|
||||
else if (tok2->str() != "*" && tok2->str() != "&")
|
||||
break;
|
||||
|
|
|
@ -186,6 +186,7 @@ private:
|
|||
TEST_CASE(varid36); // ticket #2980 (segmentation fault)
|
||||
TEST_CASE(varid37); // ticket #3092 (varid for 'Bar bar(*this);')
|
||||
TEST_CASE(varid38); // ticket #3272 (varid for 'FOO class C;')
|
||||
TEST_CASE(varid39); // ticket #3279 (varid for 'FOO::BAR const')
|
||||
TEST_CASE(varidFunctionCall1);
|
||||
TEST_CASE(varidFunctionCall2);
|
||||
TEST_CASE(varidFunctionCall3);
|
||||
|
@ -2955,6 +2956,13 @@ private:
|
|||
tokenizeDebugListing(code));
|
||||
}
|
||||
|
||||
void varid39() {
|
||||
const std::string code = "void f(FOO::BAR const);\n";
|
||||
ASSERT_EQUALS("\n\n##file 0\n"
|
||||
"1: void f ( FOO :: BAR const ) ;\n",
|
||||
tokenizeDebugListing(code));
|
||||
}
|
||||
|
||||
void varidFunctionCall1() {
|
||||
const std::string code("void f() {\n"
|
||||
" int x;\n"
|
||||
|
|
Loading…
Reference in New Issue