1 | /*-----------------------------------------------------------------------------+ |
2 | Copyright (c) 2011-2011: Joachim Faulhaber |
3 | +------------------------------------------------------------------------------+ |
4 | Distributed under the Boost Software License, Version 1.0. |
5 | (See accompanying file LICENCE.txt or copy at |
6 | http://www.boost.org/LICENSE_1_0.txt) |
7 | +-----------------------------------------------------------------------------*/ |
8 | #define BOOST_TEST_MODULE icl::cmp_msvc_value_born_error unit test |
9 | #include <boost/config.hpp> |
10 | #include "../unit_test_unwarned.hpp" |
11 | |
12 | namespace unhelpful{ |
13 | // This declaration of a class template will cause |
14 | // the compilation of line 17 to fail with syntax error C2059 |
15 | template<class T> class value{}; |
16 | } |
17 | |
18 | //--- affected code --------------------------------------- |
19 | template <class Type> struct meta_attribute |
20 | { |
21 | BOOST_STATIC_CONSTANT(int, value = 0); |
22 | }; |
23 | |
24 | template <class Type> struct meta_predicate |
25 | { |
26 | BOOST_STATIC_CONSTANT(bool, value = |
27 | ( meta_attribute<Type>::value < 1) |
28 | //error C2059: syntax error : ')' |
29 | //IF class template value declared before |
30 | // ((meta_attribute<Type>::value) < 1) // Remedy#1 enclose into () |
31 | // ( meta_attribute<Type>::value <=0) // Remedy#2 use operator <= |
32 | ); |
33 | }; |
34 | |
35 | BOOST_AUTO_TEST_CASE(dummy) |
36 | { |
37 | BOOST_CHECK( meta_predicate<int>::value ); |
38 | } |
39 | |
40 | |