Fixed #3584 (2 internal errors : Token::Match called with varid 0)
This commit is contained in:
parent
f183954150
commit
da8abeb63c
|
@ -2937,6 +2937,9 @@ void Tokenizer::setVarId()
|
||||||
if (tok2 && tok2->str() == "const")
|
if (tok2 && tok2->str() == "const")
|
||||||
tok2 = tok2->next();
|
tok2 = tok2->next();
|
||||||
|
|
||||||
|
if (tok2 && tok2->str() == "::")
|
||||||
|
tok2 = tok2->next();
|
||||||
|
|
||||||
while (Token::Match(tok2, "%var% ::"))
|
while (Token::Match(tok2, "%var% ::"))
|
||||||
tok2 = tok2->tokAt(2);
|
tok2 = tok2->tokAt(2);
|
||||||
|
|
||||||
|
|
|
@ -215,6 +215,7 @@ private:
|
||||||
TEST_CASE(varid_in_class2);
|
TEST_CASE(varid_in_class2);
|
||||||
TEST_CASE(varid_in_class3); // #3092 - shadow variable in member function
|
TEST_CASE(varid_in_class3); // #3092 - shadow variable in member function
|
||||||
TEST_CASE(varid_in_class4); // #3271 - public: class C;
|
TEST_CASE(varid_in_class4); // #3271 - public: class C;
|
||||||
|
TEST_CASE(varid_in_class5); // #3584 - std::vector<::FOO::B> b;
|
||||||
TEST_CASE(varid_operator);
|
TEST_CASE(varid_operator);
|
||||||
TEST_CASE(varid_throw);
|
TEST_CASE(varid_throw);
|
||||||
TEST_CASE(varid_unknown_macro); // #2638 - unknown macro is not type
|
TEST_CASE(varid_unknown_macro); // #2638 - unknown macro is not type
|
||||||
|
@ -3512,6 +3513,17 @@ private:
|
||||||
tokenizeDebugListing(code));
|
tokenizeDebugListing(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void varid_in_class5() {
|
||||||
|
const char code[] = "struct Foo {\n"
|
||||||
|
" std::vector<::X> v;\n"
|
||||||
|
"}";
|
||||||
|
ASSERT_EQUALS("\n\n##file 0\n"
|
||||||
|
"1: struct Foo {\n"
|
||||||
|
"2: std :: vector < :: X > v@1 ;\n"
|
||||||
|
"3: }\n",
|
||||||
|
tokenizeDebugListing(code));
|
||||||
|
}
|
||||||
|
|
||||||
void varid_operator() {
|
void varid_operator() {
|
||||||
{
|
{
|
||||||
const std::string actual = tokenizeDebugListing(
|
const std::string actual = tokenizeDebugListing(
|
||||||
|
|
Loading…
Reference in New Issue