~barry/ubuntu/precise/boost1.46/debian-merge

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*-----------------------------------------------------------------------------+    
Copyright (c) 2011-2011: Joachim Faulhaber
+------------------------------------------------------------------------------+
   Distributed under the Boost Software License, Version 1.0.
      (See accompanying file LICENCE.txt or copy at
           http://www.boost.org/LICENSE_1_0.txt)
+-----------------------------------------------------------------------------*/
#define BOOST_TEST_MODULE icl::cmp_msvc_value_born_error unit test
#include <boost/config.hpp>
#include "../unit_test_unwarned.hpp"

namespace unhelpful{
    // This declaration of a class template will cause
    // the compilation of line 17 to fail with syntax error C2059
    template<class T> class value{};
}

//--- affected code ---------------------------------------
template <class Type> struct meta_attribute
{ 
    BOOST_STATIC_CONSTANT(int, value = 0); 
};

template <class Type> struct meta_predicate
{ 
    BOOST_STATIC_CONSTANT(bool, value = 
        ( meta_attribute<Type>::value  < 1)
        //error C2059: syntax error : ')'
        //IF class template value declared before
    //  ((meta_attribute<Type>::value) < 1) // Remedy#1 enclose into ()
    //  ( meta_attribute<Type>::value  <=0) // Remedy#2 use operator <= 
        );
};

BOOST_AUTO_TEST_CASE(dummy)
{
    BOOST_CHECK( meta_predicate<int>::value );
}