fix_include_after_thread.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. //JODO REMOVE THIS TESTCASE
  9. #define BOOST_TEST_MODULE icl::fix_include_after_thread unit test
  10. #include <boost/config.hpp>
  11. #include <boost/test/unit_test.hpp>
  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> MEMO: The problem occured when using thread.hpp
  20. #include <boost/bind.hpp> // but is also triggered from bind.hpp alone
  21. // while the cause of it is an error in the msvc-7.1 to 10.0 compilers.
  22. // A minimal example is provided by test case 'cmp_msvc_value_born_error'
  23. //--- included code ---------------------------------------
  24. template <class Type> struct some_attribute
  25. {
  26. BOOST_STATIC_CONSTANT(int, value = 0);
  27. };
  28. template <class Type> struct some_predicate
  29. {
  30. BOOST_STATIC_CONSTANT(bool,
  31. value = ((some_attribute<Type>::value) < 0)
  32. // value = ( some_attribute<Type>::value < 0)
  33. //error C2059: syntax error : ')' ONLY
  34. //IF <boost/thread.hpp> is included before
  35. );
  36. };
  37. //--- end of included code --------------------------------
  38. BOOST_AUTO_TEST_CASE(dummy)
  39. {
  40. BOOST_CHECK(true);
  41. }