You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The operator== in RuleContext only mildly looked like the
virtual operator== in the base class: it does take a different
parameter and was not const. Even if it was selected, the
implementation is exactly the same as in the base class
(comparing pointers).
This results in warnings by the compiler complaining about a shadowed method:
```
/usr/include/antlr4-runtime/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;
| ^~~~~~~~
/usr/include/antlr4-runtime/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.
```
Verdict: remove operator to not confuse humans and computers.
Signed-off-by: Henner Zeller <h.zeller@acm.org>
0 commit comments