You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code is at https://godbolt.org/z/KvjecnTe3. The code can be compiled if switching to clang 13.0.1, but gcc 11.2 or the trunk version fails. Interestingly, if I comment out line 22 and 23 as
Commenting out line 22 (Foo::A1) is enough. It looks like GCC doesn't take into account the type of EnumVal, just its value (which is 0 for both A1 and B1).
Thanks! this works for me. Just for your information, I tried similar code by using boost::mpl and it works (https://godbolt.org/z/zeGdoa3Te) for both gcc and clang.
Looks like a GCC bug. I'll try to figure out why it happens. Here's a workaround:
template <auto EnumVal> using enum_ = std::integral_constant<decltype(EnumVal), EnumVal>;
The code is at https://godbolt.org/z/KvjecnTe3. The code can be compiled if switching to clang 13.0.1, but gcc 11.2 or the trunk version fails. Interestingly, if I comment out line 22 and 23 as
then gcc can successfully compile the code. Any ideas?
The text was updated successfully, but these errors were encountered: