This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RE : Problem with _Hashtable_ebo_helper


On 10/23/2013 02:53 AM, frs.dumont@gmail.com wrote:
That is indeed an issue. We have to force the 3rd template parameter to
true in this context because we are using _Hastable_ebo_helper here only
for convenience to access protected default ctor if any. We know that
_Hashtable_code_base is not final so it is safe to force true. I'll
submit a patch when back home.

What do you think about this more general change?

Jason

diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
index ed9e9dd..01adeb6 100644
--- a/libstdc++-v3/include/bits/hashtable_policy.h
+++ b/libstdc++-v3/include/bits/hashtable_policy.h
@@ -969,10 +969,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *  Primary class template _Hashtable_ebo_helper.
    *
    *  Helper class using EBO when it is not forbidden (the type is not
-   *  final) and when it is worth it (the type is empty.)
+   *  final) and when it is worth it (the type is empty) or necessary (the
+   *  type has a protected default constructor).
    */
   template<int _Nm, typename _Tp,
-	   bool __use_ebo = !__is_final(_Tp) && __is_empty(_Tp)>
+	   bool __use_ebo = (!__is_final(_Tp)
+			     && (__is_empty(_Tp)
+				 || !is_default_constructible<_Tp>::value))>
     struct _Hashtable_ebo_helper;
 
   /// Specialization using EBO.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]