Skip to content

C23 structure and union compatibility should allow for compatible members #149965

@Halalaluyafail3

Description

@Halalaluyafail3

It seems like Clang is working to support C23 new tag compatibility rules, however there are some issues currently. Here is one of them:

struct A{int h;};
int main(){
    extern struct A x;
    enum E:int{e};
    struct A{enum E h;};
    extern struct A x;
}

Clang rejects this code because it considers the two structure types to be incompatible. They should be compatible because int and enum E are compatible, exact type equivalence is not required by the standard. The resulting composite type for x should have h as the composite type of int and enum E.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c23clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partydiverges-from:gccDoes the clang frontend diverge from gcc on this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions