Skip to content

[Clang] Missing deduction error diagnostic in C when array size is different #162694

@to268

Description

@to268

Since type inference was implemented in Clang for C23, it appears that we do not check if there is a mismatch between the declared type and the deduced type in C, as we do in C++.

For example: auto s[3] = "abc" is deduced as char[4] and therefore should not be compatible with char[3], but we do not enforce this check in C mode and end up with char[4] instead of bailing out with char[3] != char[4].

Godbolt C example
Godbolt C++ example

Metadata

Metadata

Assignees

No one assigned

    Labels

    c23clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions