Skip to content

Clang should emit pedantic warnings for conversions to/from pointers to qualified arrays #9454

@rjmccall

Description

@rjmccall
Bugzilla Link 9082
Version trunk
OS All
CC @ostash,@zygoloid

Extended Description

According to the C standard, conversions like the following are technically casting away const-ness, because array types are never qualified: qualifiers apply only to the element type.
const void * -> const int ()[5]
const int * -> const int (
)[5]

Similarly, this is not supposed to be a valid qualification conversion:
int ()[10] -> const int ()[10]

These are kindof arbitrary restrictions that do make life unnecessarily difficult for real users; I think clang's model (where the array and element are simultaneously qualified) really makes a lot more sense. Nonetheless, we should at the very least provide -pedantic warnings about these conversions not being permitted by the standard(s).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillacclang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerwontfixIssue is real, but we can't or won't fix it. Not invalid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions