Commit 7b53e13
authored
RuleContext: remove superfluous operator== (#4799)
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 <[email protected]>1 parent 5435f14 commit 7b53e13
1 file changed
+0
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
142 | | - | |
143 | 141 | | |
144 | 142 | | |
145 | 143 | | |
| |||
0 commit comments