[libcxx] r283715 - Provide a constexpr addressof with GCC 7.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 9 22:34:18 PDT 2016


Author: ericwf
Date: Mon Oct 10 00:34:18 2016
New Revision: 283715

URL: http://llvm.org/viewvc/llvm-project?rev=283715&view=rev
Log:
Provide a constexpr addressof with GCC 7.

__builtin_addressof was added to the GCC trunk in the past week. This patch
teaches libc++ about it so it can correctly provide constexpr addressof.

Unfortunately this patch will break users of earlier GCC 7 builds, since
we expect __builtin_addressof but one won't be provided. One option would be
to only use __builtin_addressof for GCC 7.1 and above, but that means
waiting for another release.

Instead I've specifically chosen to break older GCC 7 versions. Since GCC 7
has yet to be released, and the 7.0 release is a development release, I
believe that anybody currently using GCC 7.0 will have no issue upgrading.

Modified:
    libcxx/trunk/include/type_traits
    libcxx/trunk/test/libcxx/test/config.py
    libcxx/trunk/test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp

Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=283715&r1=283714&r2=283715&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Mon Oct 10 00:34:18 2016
@@ -425,7 +425,7 @@ template <bool _Bp, class _Tp = void> us
 #endif
 
 // addressof
-#if __has_builtin(__builtin_addressof)
+#if __has_builtin(__builtin_addressof) || _GNUC_VER >= 700
 
 template <class _Tp>
 inline _LIBCPP_CONSTEXPR_AFTER_CXX14

Modified: libcxx/trunk/test/libcxx/test/config.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=283715&r1=283714&r2=283715&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/test/config.py (original)
+++ libcxx/trunk/test/libcxx/test/config.py Mon Oct 10 00:34:18 2016
@@ -179,6 +179,7 @@ class Configuration(object):
             assert self.cxx.version is not None
             maj_v, min_v, _ = self.cxx.version
             self.config.available_features.add(cxx_type)
+            self.config.available_features.add('%s-%s' % (cxx_type, maj_v))
             self.config.available_features.add('%s-%s.%s' % (
                 cxx_type, maj_v, min_v))
 

Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp?rev=283715&r1=283714&r2=283715&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp Mon Oct 10 00:34:18 2016
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: gcc
+// XFAIL: gcc-4, gcc-5, gcc-6
 
 // <memory>
 




More information about the cfe-commits mailing list