MISRA C++:2023 Rule 6.4.3
A name that is present in a dependent base shall not be resolved by unqualified lookup
Since R2024b
Description
Rule Definition
A name that is present in a dependent base shall not be resolved by unqualified lookup.
Rationale
When a class template derives from another class template, there might be confusion
arising from the use of names that exist in both the base template and the current scope or
namespace. When the same name exists in the base class template and a namespace that
contains the classes, the scope resolution of these names is dependent on the compiler,
which might be contrary to developer's expectation. To avoid confusion, use fully qualified
id or this->
to explicitly disambiguate the intended object when such
a name conflict exists.
Polyspace Implementation
Polyspace® flags names for which all of these conditions are true:
The name exists in the base class.
The name exists in a namespace that contains the base class.
The name is used without qualified id or
this->
.
Troubleshooting
If you expect a rule violation but Polyspace does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Basic Concepts |
Category: Required |
Version History
Introduced in R2024b