Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ warning + fix #4608

Open
JoD opened this issue May 1, 2024 · 2 comments
Open

C++ warning + fix #4608

JoD opened this issue May 1, 2024 · 2 comments

Comments

@JoD
Copy link

JoD commented May 1, 2024

Using g++ (Ubuntu 13.2.0-23ubuntu4) 13.2.0 gives

antlr4/tree/ParseTree.h:50:18: warning: ‘virtual bool antlr4::tree::ParseTree::operator==(const antlr4::tree::ParseTree&) const’ was hidden [-Woverloaded-virtual=]
   50 |     virtual bool operator == (const ParseTree &other) const;
      |                  ^~~~~~~~
antlr4/RuleContext.h:135:10: note:   by ‘bool antlr4::RuleContext::operator==(const antlr4::RuleContext&)’
  135 |     bool operator == (const RuleContext &other) { return this == &other; } // Simple address comparison.

The operator== in RuleContext seems redundant, as the virtual one in ParseTree performs the same check?

Proposed fix: remove this line:

bool operator == (const RuleContext &other) { return this == &other; } // Simple address comparison.

@xu20160924
Copy link

Have you solved that? I face the same problem.

@JoD
Copy link
Author

JoD commented May 12, 2024

Yes, just remove the line above (135 in Rulecontext.h) as it does nothing different from the virtual method it reimplements.

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

No branches or pull requests

2 participants