Skip to content

Compile error : enum with type specifier is invalid C - msvc compiler rejects it. #165107

@adv-sw

Description

@adv-sw

Compiled trunk using MSVC 2022.

Fails on this : https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/builtins/cpu_model/x86.c#L39

Needs something like:

#if _MSC_VER
// Not supported for C code
#define UINT_ENUM
#else
#define UINT_ENUM : unsigned int
#endif

enum ProcessorVendors UINT_ENUM {

Similarly ProcessorTypes immediately below.

Might get away with it other compilers but apparently it's invalid.

: unsigned int syntax is C++11+ only—it's invalid in C (any standard: C89/C99/C11/C17/C23).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions