/Src/Dependencies/Boost/libs/static_assert/static_assert_test_fail_4.cpp

http://hadesmem.googlecode.com/ · C++ · 38 lines · 17 code · 12 blank · 9 comment · 4 complexity · c0a808afdf875f72bcda76951f5a6ee9 MD5 · raw file

  1. // (C) Copyright Steve Cleary & John Maddock 2000.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org for most recent version including documentation.
  6. #include <boost/config.hpp>
  7. #include <boost/static_assert.hpp>
  8. //
  9. // all these tests should fail:
  10. //
  11. struct Bob
  12. {
  13. public:
  14. // Member function scope: provides access to member variables
  15. char x[4];
  16. char c;
  17. int f()
  18. {
  19. #if !defined(BOOST_MSVC) || BOOST_MSVC > 1200 // broken sizeof in VC6
  20. BOOST_STATIC_ASSERT(sizeof(x) == 4);
  21. BOOST_STATIC_ASSERT(sizeof(c) == 1);
  22. BOOST_STATIC_ASSERT((sizeof(x) == sizeof(c))); // should not compile
  23. #endif
  24. return x;
  25. }
  26. };