| 1 | /* |
|---|---|
| 2 | * Copyright Andrey Semashev 2014. |
| 3 | * Distributed under the Boost Software License, Version 1.0. |
| 4 | * (See accompanying file LICENSE_1_0.txt or copy at |
| 5 | * http://www.boost.org/LICENSE_1_0.txt) |
| 6 | */ |
| 7 | /*! |
| 8 | * \file scoped_enum_compile_fail_conv_to_int.cpp |
| 9 | * \author Andrey Semashev |
| 10 | * \date 06.06.2014 |
| 11 | * |
| 12 | * \brief This test checks that scoped enum emulation prohibits implicit conversions to int |
| 13 | */ |
| 14 | |
| 15 | #include <boost/core/scoped_enum.hpp> |
| 16 | |
| 17 | BOOST_SCOPED_ENUM_DECLARE_BEGIN(color) |
| 18 | { |
| 19 | red, |
| 20 | green, |
| 21 | blue |
| 22 | } |
| 23 | BOOST_SCOPED_ENUM_DECLARE_END(color) |
| 24 | |
| 25 | int main(int, char*[]) |
| 26 | { |
| 27 | color col = color::red; |
| 28 | int n = col; |
| 29 | |
| 30 | return n; |
| 31 | } |
| 32 |
