Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58130 - in trunk: boost/unordered boost/unordered/detail libs/unordered/test/unordered
From: daniel_james_at_[hidden]
Date: 2009-12-03 19:51:51


Author: danieljames
Date: 2009-12-03 19:51:50 EST (Thu, 03 Dec 2009)
New Revision: 58130
URL: http://svn.boost.org/trac/boost/changeset/58130

Log:
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.
Text files modified:
   trunk/boost/unordered/detail/util.hpp | 3 +++
   trunk/boost/unordered/unordered_map.hpp | 18 ++++++++++++++++++
   trunk/boost/unordered/unordered_set.hpp | 18 ++++++++++++++++++
   trunk/libs/unordered/test/unordered/link_test_2.cpp | 9 +++++++++
   4 files changed, 48 insertions(+), 0 deletions(-)

Modified: trunk/boost/unordered/detail/util.hpp
==============================================================================
--- trunk/boost/unordered/detail/util.hpp (original)
+++ trunk/boost/unordered/detail/util.hpp 2009-12-03 19:51:50 EST (Thu, 03 Dec 2009)
@@ -288,6 +288,9 @@
     {
         if (node_) {
             if (value_constructed_) {
+#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
+ struct dummy { hash_node<Alloc, Grouped> x; };
+#endif
                 boost::unordered_detail::destroy(&node_->value());
             }
 

Modified: trunk/boost/unordered/unordered_map.hpp
==============================================================================
--- trunk/boost/unordered/unordered_map.hpp (original)
+++ trunk/boost/unordered/unordered_map.hpp 2009-12-03 19:51:50 EST (Thu, 03 Dec 2009)
@@ -524,6 +524,9 @@
     inline bool operator==(unordered_map<K, T, H, P, A> const& m1,
         unordered_map<K, T, H, P, A> const& m2)
     {
+#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
+ struct dummy { unordered_map<K,T,H,P,A> x; };
+#endif
         return m1.table_.equals(m2.table_);
     }
 
@@ -531,6 +534,9 @@
     inline bool operator!=(unordered_map<K, T, H, P, A> const& m1,
         unordered_map<K, T, H, P, A> const& m2)
     {
+#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
+ struct dummy { unordered_map<K,T,H,P,A> x; };
+#endif
         return !m1.table_.equals(m2.table_);
     }
 
@@ -538,6 +544,9 @@
     inline void swap(unordered_map<K, T, H, P, A> &m1,
             unordered_map<K, T, H, P, A> &m2)
     {
+#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
+ struct dummy { unordered_map<K,T,H,P,A> x; };
+#endif
         m1.swap(m2);
     }
 
@@ -1013,6 +1022,9 @@
     inline bool operator==(unordered_multimap<K, T, H, P, A> const& m1,
         unordered_multimap<K, T, H, P, A> const& m2)
     {
+#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
+ struct dummy { unordered_multimap<K,T,H,P,A> x; };
+#endif
         return m1.table_.equals(m2.table_);
     }
 
@@ -1020,6 +1032,9 @@
     inline bool operator!=(unordered_multimap<K, T, H, P, A> const& m1,
         unordered_multimap<K, T, H, P, A> const& m2)
     {
+#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
+ struct dummy { unordered_multimap<K,T,H,P,A> x; };
+#endif
         return !m1.table_.equals(m2.table_);
     }
 
@@ -1027,6 +1042,9 @@
     inline void swap(unordered_multimap<K, T, H, P, A> &m1,
             unordered_multimap<K, T, H, P, A> &m2)
     {
+#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
+ struct dummy { unordered_multimap<K,T,H,P,A> x; };
+#endif
         m1.swap(m2);
     }
 

Modified: trunk/boost/unordered/unordered_set.hpp
==============================================================================
--- trunk/boost/unordered/unordered_set.hpp (original)
+++ trunk/boost/unordered/unordered_set.hpp 2009-12-03 19:51:50 EST (Thu, 03 Dec 2009)
@@ -489,6 +489,9 @@
     inline bool operator==(unordered_set<T, H, P, A> const& m1,
         unordered_set<T, H, P, A> const& m2)
     {
+#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
+ struct dummy { unordered_set<T,H,P,A> x; };
+#endif
         return m1.table_.equals(m2.table_);
     }
 
@@ -496,6 +499,9 @@
     inline bool operator!=(unordered_set<T, H, P, A> const& m1,
         unordered_set<T, H, P, A> const& m2)
     {
+#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
+ struct dummy { unordered_set<T,H,P,A> x; };
+#endif
         return !m1.table_.equals(m2.table_);
     }
 
@@ -503,6 +509,9 @@
     inline void swap(unordered_set<T, H, P, A> &m1,
             unordered_set<T, H, P, A> &m2)
     {
+#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
+ struct dummy { unordered_set<T,H,P,A> x; };
+#endif
         m1.swap(m2);
     }
 
@@ -954,6 +963,9 @@
     inline bool operator==(unordered_multiset<T, H, P, A> const& m1,
         unordered_multiset<T, H, P, A> const& m2)
     {
+#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
+ struct dummy { unordered_multiset<T,H,P,A> x; };
+#endif
         return m1.table_.equals(m2.table_);
     }
 
@@ -961,6 +973,9 @@
     inline bool operator!=(unordered_multiset<T, H, P, A> const& m1,
         unordered_multiset<T, H, P, A> const& m2)
     {
+#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
+ struct dummy { unordered_multiset<T,H,P,A> x; };
+#endif
         return !m1.table_.equals(m2.table_);
     }
 
@@ -968,6 +983,9 @@
     inline void swap(unordered_multiset<T, H, P, A> &m1,
             unordered_multiset<T, H, P, A> &m2)
     {
+#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
+ struct dummy { unordered_multiset<T,H,P,A> x; };
+#endif
         m1.swap(m2);
     }
 

Modified: trunk/libs/unordered/test/unordered/link_test_2.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/link_test_2.cpp (original)
+++ trunk/libs/unordered/test/unordered/link_test_2.cpp 2009-12-03 19:51:50 EST (Thu, 03 Dec 2009)
@@ -13,6 +13,15 @@
         boost::unordered_multiset<int>& x3,
         boost::unordered_multimap<int, int>& x4)
 {
+#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
+ struct dummy {
+ boost::unordered_set<int> x1;
+ boost::unordered_map<int, int> x2;
+ boost::unordered_multiset<int> x3;
+ boost::unordered_multimap<int, int> x4;
+ };
+#endif
+
     x1.insert(1);
     x2[2] = 2;
     x3.insert(3);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk