test_msvc_simd_bug981648.hpp 991 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright 2014 Andrey Semashev
  3. *
  4. * Distributed under the Boost Software License, Version 1.0.
  5. * See accompanying file LICENSE_1_0.txt or copy at
  6. * https://www.boost.org/LICENSE_1_0.txt
  7. */
  8. /*
  9. * This is a part of the test for a workaround for MSVC 12 (VS2013) optimizer bug
  10. * which causes incorrect SIMD code generation for operator==. See:
  11. *
  12. * https://svn.boost.org/trac/boost/ticket/8509#comment:3
  13. * https://connect.microsoft.com/VisualStudio/feedbackdetail/view/981648#tabs
  14. *
  15. * The header contains common definitions for the two source files.
  16. */
  17. #include <boost/uuid/uuid.hpp>
  18. using boost::uuids::uuid;
  19. class headerProperty
  20. {
  21. public:
  22. virtual ~headerProperty() {}
  23. };
  24. class my_obj:
  25. public headerProperty
  26. {
  27. public:
  28. // This char tmp[8] forces the following uuid to be misaligned.
  29. char tmp[8];
  30. // This m_uuid is misaligned (not 16-byte aligned) and causes the != operator to crash.
  31. uuid m_uuid;
  32. const uuid &get_marker_id() const { return m_uuid; }
  33. uuid get_id() const { return m_uuid; }
  34. };