]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Copyright 2009 Alexander Nasonov. |
2 | // Distributed under the Boost Software License, Version 1.0. (See | |
3 | // accompanying file LICENSE_1_0.txt or copy at | |
4 | // http://www.boost.org/LICENSE_1_0.txt) | |
5 | ||
6 | // Test bug 99776 'enum UIntEnum { value = UINT_MAX } is promoted to int' | |
7 | // http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=22b0a6b7-120f-4ca0-9136-fa1b25b26efe | |
8 | // | |
9 | // Intel 9.0.028 for Windows has a similar problem: | |
10 | // https://premier.intel.com/IssueDetail.aspx?IssueID=365073 | |
11 | ||
12 | #include <boost/type_traits/promote.hpp> | |
13 | ||
14 | #include <climits> | |
15 | #include <boost/static_assert.hpp> | |
16 | #include <boost/type_traits/is_same.hpp> | |
17 | ||
18 | #include "promote_util.hpp" | |
19 | ||
20 | #ifdef BOOST_INTEL | |
21 | // remark #1418: external function definition with no prior declaration | |
22 | #pragma warning(disable:1418) | |
23 | #endif | |
24 | ||
25 | ||
26 | enum UIntEnum { UIntEnum_max = UINT_MAX }; | |
27 | ||
28 | template<class T> | |
29 | void assert_is_uint(T) | |
30 | { | |
31 | BOOST_STATIC_ASSERT((boost::is_same<T, unsigned int>::value)); | |
32 | } | |
33 | ||
34 | void test_promote_to_uint() | |
35 | { | |
36 | assert_is_uint(+UIntEnum_max); | |
37 | test_cv< UIntEnum, unsigned int >(); | |
38 | } | |
39 | ||
40 | int main() | |
41 | { | |
42 | return 0; | |
43 | } | |
44 |