Problem with _Hashtable_ebo_helper

Jonathan Wakely jwakely.gcc@gmail.com
Tue Oct 29 16:37:00 GMT 2013


This patch replaces the problematic use of _Hashtable_ebo_helper with
a new type.

2013-10-29  Jonathan Wakely  <jwakely.gcc@gmail.com>

        * include/bits/hashtable.cc (__access_protected_ctor): Define and use
        new type instead of _Hashtable_ebo_helper.
        * testsuite/23_containers/unordered_set/
        not_default_constructible_hash_neg.cc: Adjust line number.

Tested x86_64-linux, I'll commit it to trunk today.
-------------- next part --------------
commit 507ffff86d1785911ef2d335fdcd162e71e14da4
Author: Jonathan Wakely <jwakely.gcc@gmail.com>
Date:   Tue Oct 29 15:50:00 2013 +0000

    	* include/bits/hashtable.cc (__access_protected_ctor): Define and use
    	new type instead of _Hashtable_ebo_helper.
    	* testsuite/23_containers/unordered_set/
    	not_default_constructible_hash_neg.cc: Adjust line number.

diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h
index c639c55..aae146b 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -277,14 +277,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 		    "Functor used to map hash code to bucket index"
 		    " must be default constructible");
 
+      // _Hash_code_base has a protected default constructor, so use this
+      // derived type to tell if it's usable.
+      struct __access_protected_ctor : __hash_code_base { };
+
       // When hash codes are not cached local iterator inherits from
       // __hash_code_base above to compute node bucket index so it has to be
       // default constructible.
       static_assert(__if_hash_not_cached<
-		    is_default_constructible<
-		      // We use _Hashtable_ebo_helper to access the protected
-		      // default constructor.
-		      __detail::_Hashtable_ebo_helper<0, __hash_code_base, true>>>::value,
+		    is_default_constructible<__access_protected_ctor>>::value,
 		    "Cache the hash code or make functors involved in hash code"
 		    " and bucket index computation default constructible");
 
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/not_default_constructible_hash_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/not_default_constructible_hash_neg.cc
index 3332cc5..4216b91 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/not_default_constructible_hash_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/not_default_constructible_hash_neg.cc
@@ -19,7 +19,7 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// { dg-error "default constructible" "" { target *-*-* } 283 }
+// { dg-error "default constructible" "" { target *-*-* } 287 }
 
 #include <unordered_set>
 


More information about the Gcc-patches mailing list