[Bug c/81665] Please introduce flags attribute for enums which will mimic one from C#

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 12 09:39:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81665

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Daniel Fruzynski from comment #0)
> - to eliminate above error, one has to define custom | operator for enum
> type. However when it is not marked as a constexpr, it causes another
> compilation error when its result is used as a case value:
> test-enum-op.c:25:15: error: call to non-constexpr function ‘Values
> operator|(Values, Values)’
>      case Val2 | Val3:
>                ^

So mark it constexpr then. Getting an error for incorrect code is good.

(I have no comment on the rest of the report).


More information about the Gcc-bugs mailing list