This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[patch] Fix two libstdc++ test failures with -std=gnu++14


This fixes two test failures when the default compiler mode is
-std=gnu++14

FAIL: 25_algorithms/headers/algorithm/synopsis.cc (test for excess errors)
FAIL: ext/profile/mutex_extensions_neg.cc (test for excess errors)

I don't really like the change to the synopsis.cc test, but I don't
think reproducing the SFINAE constraints in the test is ideal either.

The mutex_extensions_neg.cc test works now, but I think we're missing
specializations of __is_tuple_like_impl for __gnu_debug::array and
__gnu_profile::array.

Tested powerpc64le-linux, committed to trunk.

commit bbe0c26afcee10bfb00f43abe32bb72f8666473b
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Jun 12 00:13:17 2015 +0100

    	* include/std/tuple (__is_tuple_like_impl): Disambiguate array in
    	debug and profile modes.
    	* testsuite/25_algorithms/headers/algorithm/synopsis.cc: Adjust tests
    	for swap in C++11 and later.

diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index ccea02b..953d16b 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -989,7 +989,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { };
 
   template<typename _Tp, std::size_t _Nm>
-    struct __is_tuple_like_impl<array<_Tp, _Nm>> : true_type
+    struct __is_tuple_like_impl<_GLIBCXX_STD_C::array<_Tp, _Nm>> : true_type
     { };
 
   // Internal type trait that allows us to sfinae-protect tuple_cat.
diff --git a/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc
index 4758796..7b11872 100644
--- a/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc
@@ -136,14 +136,18 @@ namespace std
     copy_backward (_BIter1, _BIter1, _BIter2);
 
   // 25.2.2, swap:
+#if __cplusplus < 201103L
   template<typename _Tp> 
     void 
     swap(_Tp&, _Tp& b);
 
-#if __cplusplus >= 201103L
   template<typename _Tp, size_t _Nm>
     void
     swap(_Tp (&)[_Nm], _Tp (&)[_Nm]);
+#else
+  // C++11 swap() has complicated SFINAE constraints, test signatures like so:
+  void (*swap_scalars)(int&, int&) = &swap;
+  void (*swap_arrays)(int(&)[5], int(&)[5]) = &swap;
 #endif
 
   template<typename _FIter1, typename _FIter2>

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