This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about a warning message


On Thu, 6 Sep 2018 at 20:30, Juan Cabrera <jjcp.91@gmail.com> wrote:
>
> Hello!
>
> Thank you for your answers.
> I'm aware that you can cast anything into an `enum class` but I
> thought that casting a non valid enum-class value into an enum-class
> was itself "wrong" or "unedfined behavior" or something like that :D.

No, because for an enum class all values of the underlying type are
valid values of the enum.

The compiler is right to warn.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]