Open
Description
Affected rules
DCL51-CPP
Description
The rule currently enforces that function names defined in standard library headers are not reused in any namespace. However, a careful re-reading of the C++ standard suggests that's overly specific. [reserved.names]
specifically states that the only kinds of name that are reserved are macros, "global names" and "names with external linkage". In [extern.names]
, the standard says:
Each global function signature declared with external linkage in a header is reserved to the implementation to designate that function signature with external linkage.
So only global function signatures are reserved, and only where they have external linkage. I think we need to do the following:
- Apply only to the global namespace
- Filter list of reserved function names by those that appear in the global namespace and have external linkage (this may already be the case).
- Match function signatures (I believe it is valid to reuse the name as long as the signature is different).
We may also need to review the rules for objects and _
prefixes.
Example
namespace MyNamespace {
void all_of(); // COMPLIANT
}
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
In Progress