This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: RE : Problem with _Hashtable_ebo_helper
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: François Dumont <frs dot dumont at gmail dot com>, "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Mon, 28 Oct 2013 21:36:46 +0000
- Subject: Re: RE : Problem with _Hashtable_ebo_helper
- Authentication-results: sourceware.org; auth=none
- References: <526590F3 dot 6070505 at redhat dot com> <s68065723591507235000 at gmail dot com> <52680F5D dot 4020908 at redhat dot com> <CAH6eHdStyUYZXXOGEVMgC6w3XxPyNOkY7Qf0bcxx0+Npuf0Vuw at mail dot gmail dot com> <526EB119 dot 6070000 at redhat dot com> <CAH6eHdSEa1QUYxDomaKk4gWxGymjpV4OR3V5+Bf5gFYAD5U9hw at mail dot gmail dot com>
On 28 October 2013 21:26, Jonathan Wakely wrote:
>
> If what we want is a type that derives from __hash_code_base in order
> to check if that dervide type would be default constructible then we
> should create a new type that does that, not appropriate
> _Hashtable_ebo_helper for something it isn't designed for, and after
> your fix doesn't even work for!
Like so:
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");
I'll test this.