Skip to content

Microsoft extension: Allowing forward declaration of emum w/ fixed underlying type to be defined w/o fixed underlying type #122032

@shafik

Description

@shafik

Given the following code: https://godbolt.org/z/K64Kbfso3

enum E : int;
enum E {};

clang rejects this code b/c the definition does not provide a fixed underlying type but MSVC and edg w/ --microsoft accept this as an extension.

Combined with another MSVC extension this can lead to some rather puzzling code until you break it down far enough: https://godbolt.org/z/PKPGMr3jE

enum E {EA}; 

namespace A {
  typedef enum E : int E; 
}

namespace A {
enum E {EB};


void f() {
    E e{EB};
}
}

Do we want to support this extension?

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"diverges-from:msvcDoes the clang frontend diverge from msvc on this issueextension:microsoft

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions