Skip to content

[Clang] Clang-cl mode is bug-compatible with MSVC on completeness of enumeration types #169472

@frederick-vs-ja

Description

@frederick-vs-ja

The following example should be rejected, because E is an enumeration type without fixed underlying type and thus incomplete within it's enumerator list. However, Clang currently accepts in Clang-cl mode (demo).

enum E {
  n = sizeof(E),
};

Another example shows that the underlying type is assumed to be int here.

As MSVC is (incorrectly) doing the same, perhaps such behavior is kept for bug-compatibility. But given such "extension" can be undesired, because the underlying type can become another type when the enumeration becomes complete, perhaps we should consider turning it off by default, or even removing it one day.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-cl`clang-cl` driver. Don't use for other compiler partsclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions