Possible defect: enum with fixed underlying type - undefined behavior with out of range values

32 views
Skip to first unread message

shmuel...@gmail.com

unread,
Sep 21, 2016, 4:32:18 PM9/21/16
to ISO C++ Standard - Discussion
  1. The underlying type is not required to be able to represent all of the enum values.
  2.  An unrepresentable value can occur in some cases, for example: 
 enum foo : bool { True=true, undefined }

See: https://stackoverflow.com/questions/39621098/what-happens-if-an-enum-cannot-fit-into-an-unsigned-integral-type
Reply all
Reply to author
Forward
0 new messages