From c8b893cb77205de761297e48fdcc691fcc6e6e03 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 4 Dec 2009 00:51:50 +0000 Subject: [PATCH] Workaround codegear ICE. It seems that the problem is calling sizeof on a dependent type when the containers have only been used by reference. So by putting in these dummy structures with the containers as members, it helps the compiler instantiate the class to the level where sizeof works. I hope. [SVN r58130] --- include/boost/unordered/detail/util.hpp | 3 +++ include/boost/unordered/unordered_map.hpp | 18 ++++++++++++++++++ include/boost/unordered/unordered_set.hpp | 18 ++++++++++++++++++ test/unordered/link_test_2.cpp | 9 +++++++++ 4 files changed, 48 insertions(+) diff --git a/include/boost/unordered/detail/util.hpp b/include/boost/unordered/detail/util.hpp index 1f592dd3..22b41583 100644 --- a/include/boost/unordered/detail/util.hpp +++ b/include/boost/unordered/detail/util.hpp @@ -288,6 +288,9 @@ namespace boost { namespace unordered_detail { { if (node_) { if (value_constructed_) { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { hash_node x; }; +#endif boost::unordered_detail::destroy(&node_->value()); } diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp index 10d72829..ef649897 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -524,6 +524,9 @@ namespace boost inline bool operator==(unordered_map const& m1, unordered_map const& m2) { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_map x; }; +#endif return m1.table_.equals(m2.table_); } @@ -531,6 +534,9 @@ namespace boost inline bool operator!=(unordered_map const& m1, unordered_map const& m2) { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_map x; }; +#endif return !m1.table_.equals(m2.table_); } @@ -538,6 +544,9 @@ namespace boost inline void swap(unordered_map &m1, unordered_map &m2) { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_map x; }; +#endif m1.swap(m2); } @@ -1013,6 +1022,9 @@ namespace boost inline bool operator==(unordered_multimap const& m1, unordered_multimap const& m2) { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_multimap x; }; +#endif return m1.table_.equals(m2.table_); } @@ -1020,6 +1032,9 @@ namespace boost inline bool operator!=(unordered_multimap const& m1, unordered_multimap const& m2) { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_multimap x; }; +#endif return !m1.table_.equals(m2.table_); } @@ -1027,6 +1042,9 @@ namespace boost inline void swap(unordered_multimap &m1, unordered_multimap &m2) { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_multimap x; }; +#endif m1.swap(m2); } diff --git a/include/boost/unordered/unordered_set.hpp b/include/boost/unordered/unordered_set.hpp index f2af28af..59843fd6 100644 --- a/include/boost/unordered/unordered_set.hpp +++ b/include/boost/unordered/unordered_set.hpp @@ -489,6 +489,9 @@ namespace boost inline bool operator==(unordered_set const& m1, unordered_set const& m2) { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_set x; }; +#endif return m1.table_.equals(m2.table_); } @@ -496,6 +499,9 @@ namespace boost inline bool operator!=(unordered_set const& m1, unordered_set const& m2) { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_set x; }; +#endif return !m1.table_.equals(m2.table_); } @@ -503,6 +509,9 @@ namespace boost inline void swap(unordered_set &m1, unordered_set &m2) { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_set x; }; +#endif m1.swap(m2); } @@ -954,6 +963,9 @@ namespace boost inline bool operator==(unordered_multiset const& m1, unordered_multiset const& m2) { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_multiset x; }; +#endif return m1.table_.equals(m2.table_); } @@ -961,6 +973,9 @@ namespace boost inline bool operator!=(unordered_multiset const& m1, unordered_multiset const& m2) { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_multiset x; }; +#endif return !m1.table_.equals(m2.table_); } @@ -968,6 +983,9 @@ namespace boost inline void swap(unordered_multiset &m1, unordered_multiset &m2) { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_multiset x; }; +#endif m1.swap(m2); } diff --git a/test/unordered/link_test_2.cpp b/test/unordered/link_test_2.cpp index abcf2130..ff6432de 100644 --- a/test/unordered/link_test_2.cpp +++ b/test/unordered/link_test_2.cpp @@ -13,6 +13,15 @@ void foo(boost::unordered_set& x1, boost::unordered_multiset& x3, boost::unordered_multimap& x4) { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { + boost::unordered_set x1; + boost::unordered_map x2; + boost::unordered_multiset x3; + boost::unordered_multimap x4; + }; +#endif + x1.insert(1); x2[2] = 2; x3.insert(3);