C++ Logo

std-discussion

Advanced search

bit field: is enum A : 1 valid syntax?

From: Eric Suen <eric_suen_at_[hidden]>
Date: Fri, 21 May 2021 05:47:48 +0800
Hello,

I'm writing a cpp parse, constant-expression is conflict with enum-base
or class base-clause, do I need look ahead and check?

enum A {
};

struct S {
   enum A :1;
   enum A a:1;
};

gcc accept both, clang and vs only accept 2nd

Regards,

Eric

Received on 2021-05-20 16:47:59