[libcxx] r300510 - Work around GCC 4.9 bug regarding default initialization of const variables

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 17 15:32:02 PDT 2017


Author: ericwf
Date: Mon Apr 17 17:32:02 2017
New Revision: 300510

URL: http://llvm.org/viewvc/llvm-project?rev=300510&view=rev
Log:
Work around GCC 4.9 bug regarding default initialization of const variables

Modified:
    libcxx/trunk/include/memory

Modified: libcxx/trunk/include/memory
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=300510&r1=300509&r2=300510&view=diff
==============================================================================
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Mon Apr 17 17:32:02 2017
@@ -2079,17 +2079,12 @@ struct __compressed_pair_elem {
   typedef const _Tp& const_reference;
 
 #ifndef _LIBCPP_CXX03_LANG
-  template <bool _Dummy = true, class = typename enable_if<
-      __dependent_type<is_default_constructible<_Tp>, _Dummy>::value
-    >::type
-  >
-  _LIBCPP_CONSTEXPR __compressed_pair_elem()
-      _NOEXCEPT_(is_nothrow_default_constructible<_Tp>::value)
-    : __value_() {}
+  constexpr __compressed_pair_elem() : __value_() {}
 
   template <class _Up, class = typename enable_if<
-                           !is_same<__compressed_pair_elem, _Up>::value>::type>
-  _LIBCPP_CONSTEXPR explicit
+      !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value
+  >::type>
+  constexpr explicit
   __compressed_pair_elem(_Up&& __u)
       : __value_(_VSTD::forward<_Up>(__u)){};
 
@@ -2118,11 +2113,12 @@ struct __compressed_pair_elem<_Tp, _Idx,
   typedef _Tp __value_type;
 
 #ifndef _LIBCPP_CXX03_LANG
-  _LIBCPP_CONSTEXPR __compressed_pair_elem() = default;
+  constexpr __compressed_pair_elem() = default;
 
   template <class _Up, class = typename enable_if<
-                           !is_same<__compressed_pair_elem, _Up>::value>::type>
-  _LIBCPP_CONSTEXPR explicit
+        !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value
+  >::type>
+  constexpr explicit
   __compressed_pair_elem(_Up&& __u)
       : __value_type(_VSTD::forward<_Up>(__u)){};
 
@@ -2161,8 +2157,14 @@ class __compressed_pair : private __comp
 
 public:
 #ifndef _LIBCPP_CXX03_LANG
+  template <bool _Dummy = true,
+      class = typename enable_if<
+          __dependent_type<is_default_constructible<_T1>, _Dummy>::value &&
+          __dependent_type<is_default_constructible<_T2>, _Dummy>::value
+      >::type
+  >
   _LIBCPP_INLINE_VISIBILITY
-  __compressed_pair() = default;
+  constexpr __compressed_pair() {}
 
   template <class _Tp, typename enable_if<!is_same<typename decay<_Tp>::type,
                                                    __compressed_pair>::value,




More information about the cfe-commits mailing list