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:
kroening 2014-11-02 13:18:15 +00:00
parent b7a3f6df1c
commit c475dfc2c4
2 changed files with 22 additions and 0 deletions

View File

@ -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;
}

View File

@ -0,0 +1,8 @@
KNOWNBUG
main.cpp
^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
^CONVERSION ERROR$