| 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::fix_include_after_thread unit test
|
|---|
| 9 | #include <boost/config.hpp>
|
|---|
| 10 | #include <boost/test/unit_test.hpp>
|
|---|
| 11 |
|
|---|
| 12 | //Problem: If <boost/thread.hpp> is included before this
|
|---|
| 13 | //example code, it influences compilation: Code that has
|
|---|
| 14 | //compiled well, produces a syntax error error C2059 under
|
|---|
| 15 | //msvc-9/10. This can be fixed by enclosing subexpressions
|
|---|
| 16 | //like some_attribute<Type>::value in parentheses
|
|---|
| 17 | // ->(some_attribute<Type>::value)
|
|---|
| 18 | //The problem does not occur for gcc compilers.
|
|---|
| 19 | #include <boost/thread.hpp>
|
|---|
| 20 | //--- included code ---------------------------------------
|
|---|
| 21 | template <class Type> struct some_attribute
|
|---|
| 22 | {
|
|---|
| 23 | BOOST_STATIC_CONSTANT(int, value = 0);
|
|---|
| 24 | };
|
|---|
| 25 |
|
|---|
| 26 | template <class Type> struct some_predicate
|
|---|
| 27 | {
|
|---|
| 28 | BOOST_STATIC_CONSTANT(bool,
|
|---|
| 29 | value = ((some_attribute<Type>::value) < 0)
|
|---|
| 30 | // value = ( some_attribute<Type>::value < 0)
|
|---|
| 31 | //error C2059: syntax error : ')' ONLY
|
|---|
| 32 | //IF <boost/thread.hpp> is included before
|
|---|
| 33 | );
|
|---|
| 34 | };
|
|---|
| 35 | //--- end of included code --------------------------------
|
|---|
| 36 |
|
|---|
| 37 | BOOST_AUTO_TEST_CASE(dummy)
|
|---|
| 38 | {
|
|---|
| 39 | BOOST_CHECK(true);
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|