FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix #14972 [regression] Syntax Error: AST broken, '!' doesn't have an operand. by chrchr-github · Pull Request #8791 · cppcheck-opensource/cppcheck · GitHub

Fix #14972 [regression] Syntax Error: AST broken, '!' doesn't have an operand. - #8791

Open
chrchr-github wants to merge 1 commit into
cppcheck-opensource:mainfrom
chrchr-github:chr_14972
Open

Fix #14972 [regression] Syntax Error: AST broken, '!' doesn't have an operand.#8791
chrchr-github wants to merge 1 commit into
cppcheck-opensource:mainfrom
chrchr-github:chr_14972

Conversation

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread lib/tokenize.cpp
Token *tok = matchMemberName(var, scopeInfo);
if (Token::Match(tok, "%name%")) {
if (!tok->next() || tok->strAt(1) != "(" || (tok->tokAt(2) && tok->tokAt(2)->isLiteral()))
if (!tok->next() || tok->strAt(1) != "(" || (tok->tokAt(2) && (tok->tokAt(2)->isLiteral() || tok->tokAt(2)->isOp())))

danmar Aug 22, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

this looks fragile. Can you make sure it works with more than 1 parenthesis. I.e.:

struct Test {
    static bool constant;
};

bool Test::constant((!false));

I recommend a while loop that skips ( tokens.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Those parentheses are removed by simplifyRedundantParentheses(). Also, this change doesn't make the code more fragile than it already was.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL