Fixed #3648 (Internal error: Token::Match called with varid 0)
This commit is contained in:
parent
d6c8de104c
commit
a2351ba44f
|
@ -2867,7 +2867,7 @@ void Tokenizer::setVarId()
|
|||
if (tok->str() == "unsigned")
|
||||
tok = tok->next();
|
||||
|
||||
if (Token::Match(tok, "using namespace %type% ;")) {
|
||||
if (Token::Match(tok, "using namespace| %type% ;")) {
|
||||
tok = tok->next();
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -224,6 +224,7 @@ private:
|
|||
TEST_CASE(varid_operator);
|
||||
TEST_CASE(varid_throw);
|
||||
TEST_CASE(varid_unknown_macro); // #2638 - unknown macro is not type
|
||||
TEST_CASE(varid_using); // ticket #3648
|
||||
|
||||
TEST_CASE(varidclass1);
|
||||
TEST_CASE(varidclass2);
|
||||
|
@ -3635,6 +3636,14 @@ private:
|
|||
ASSERT_EQUALS(expected, tokenizeDebugListing(code));
|
||||
}
|
||||
|
||||
void varid_using() {
|
||||
// #3648
|
||||
const char code[] = "using std::size_t;";
|
||||
const char expected[] = "\n\n##file 0\n"
|
||||
"1: using long ;\n";
|
||||
ASSERT_EQUALS(expected, tokenizeDebugListing(code));
|
||||
}
|
||||
|
||||
void varidclass1() {
|
||||
const std::string actual = tokenizeDebugListing(
|
||||
"class Fred\n"
|
||||
|
|
Loading…
Reference in New Issue