ES.87 (redundant == or !=) Fix dynamic_cast to Circle pointer (#2168)

The second ES.87 example seemed to mistakenly assume that `Circle` is pointer type, by the way it was using `dynamic_cast`. However, `Circle` is meant to be a class type instead. This fix is consistent with other examples, that also do `dynamic_cast<Circle*>`.
This commit is contained in:
Niels Dekker
2024-01-09 05:51:31 +01:00
committed by GitHub
parent e49158aa7e
commit 8789617b23

View File

@@ -13335,9 +13335,9 @@ whereas `if (p != nullptr)` would be a long-winded workaround.
This rule is especially useful when a declaration is used as a condition
if (auto pc = dynamic_cast<Circle>(ps)) { ... } // execute if ps points to a kind of Circle, good
if (auto pc = dynamic_cast<Circle*>(ps)) { ... } // execute if ps points to a kind of Circle, good
if (auto pc = dynamic_cast<Circle>(ps); pc != nullptr) { ... } // not recommended
if (auto pc = dynamic_cast<Circle*>(ps); pc != nullptr) { ... } // not recommended
##### Example