C++11 enum classes
git-svn-id: svn+ssh://svn.cprover.org/srv/svn/cbmc/trunk@4714 6afb6bc1-c8e4-404c-8f48-9ae832c5b171
This commit is contained in:
parent
b7a3f6df1c
commit
c475dfc2c4
|
@ -0,0 +1,14 @@
|
|||
enum class Color : char { red, blue };
|
||||
|
||||
// defaults to int
|
||||
enum class TrafficLight { red, yellow, green };
|
||||
|
||||
static_assert(sizeof(Color)==sizeof(char), "size of Color");
|
||||
static_assert(sizeof(Color::red)==sizeof(char), "size of Color::red");
|
||||
static_assert(sizeof(TrafficLight::red)==sizeof(int), "size of TrafficLight::red");
|
||||
|
||||
int main()
|
||||
{
|
||||
Color c;
|
||||
c=Color::red;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
KNOWNBUG
|
||||
main.cpp
|
||||
|
||||
^EXIT=0$
|
||||
^SIGNAL=0$
|
||||
--
|
||||
^warning: ignoring
|
||||
^CONVERSION ERROR$
|
Loading…
Reference in New Issue