On Sat, Jan 27, 2024 at 6:24 PM Andrew Pinski <pins...@gmail.com> wrote:
>
> On Sat, Jan 27, 2024 at 6:07 PM Thomas Voss via Gcc-bugs
> <gcc-bugs@gcc.gnu.org> wrote:
> >
> > Hi all,
> >
> > Earlier today I decided to clone the GCC repo and build the latest code
> > just to play around with some new C23 features.  One thing I attempted
> > was the following:
> >
> >     typedef _BitInt(128) underlying;
> >     enum my_enum : underlying {
> >         FOO = (underlying)1 << 100;
> >         BAR = (underlying)1 << 101;
> >     };
> >
> > I expected this to work — it builds on Clang too — but it failed to
> > compile with the error ‘invalid underlying type’ (or something like that;
> > I’m going off of memory).
>
> The trunk  of clang rejects it:
> ```
> <source>:4:20: error: 'underlying' (aka '_BitInt(128)') is an invalid
> underlying type
>     4 |     enum my_enum : underlying {
>       |                    ^
> ```
> While clang 17.0 accepts it.  So it looks like clang fixed their bug.

Just an FYI, the clang issue was
https://github.com/llvm/llvm-project/issues/69619 .
With the following commit to the LLVM git repo as the fix:
https://github.com/llvm/llvm-project/commit/5175cd777c57190ab9860c304796d386e4df9b8f


>
> Thanks,
> Andrew
>
> >
> > I took a look into the C23 working draft and I see no reference to
> > bit-precise integers being disallowed as an underlying type to an
> > enumeration.  As a result I assume this is a bug in GCC so I’m reporting
> > it here just in case.  If it’s not a bug, do let me know why that is the
> > case.
> >
> > --
> > — Thomas

Reply via email to