public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [v3 PATCH] Implement LWG 2729 for pair.
@ 2016-08-17  4:41 Ville Voutilainen
  2016-09-21 10:52 ` Jonathan Wakely
  0 siblings, 1 reply; 7+ messages in thread
From: Ville Voutilainen @ 2016-08-17  4:41 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 925 bytes --]

Tested on Linux-PPC64.

2016-08-16  Ville Voutilainen  <ville.voutilainen@gmail.com>

    Implement LWG 2729 for pair.
    * include/bits/stl_pair.h (_PCC): New.
    (_ConstructiblePair, _ImplicitlyConvertiblePair):
    Turn into static member functions of _PCC.
    (_MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): Likewise.
    (_PCCP): New.
    (pair(const _T1&, const _T2&)): Adjust.
    (_PCCFP): New.
    (pair(const pair<_U1, _U2>&)): Adjust.
    (pair(_U1&&, const _T2&)): Likewise.
    (pair(const _T1&, _U2&&)): Likewise.
    (pair(_U1&&, _U2&&)): Likewise.
    (pair(pair<_U1, _U2>&&)): Likewise.
    (operator=(const pair&)): Make conditionally deleted.
    (operator=(pair&&)): Make conditionally suppressed.
    (operator=(const pair<_U1, _U2>&)): Constrain.
    (operator=(pair<_U1, _U2>&&): Likewise.
    * include/std/type_traits (__nonesuch): New.
    * testsuite/20_util/pair/traits.cc: Likewise.

[-- Attachment #2: lwg2729.diff --]
[-- Type: text/plain, Size: 17283 bytes --]

diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h
index 5ff160a..ef52538 100644
--- a/libstdc++-v3/include/bits/stl_pair.h
+++ b/libstdc++-v3/include/bits/stl_pair.h
@@ -88,52 +88,95 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // Concept utility functions, reused in conditionally-explicit
   // constructors.
   // See PR 70437, don't look at is_constructible or
-  // is_convertible if the decayed types are the same to
+  // is_convertible if the types are the same to
   // avoid querying those properties for incomplete types.
-  template <typename _T1, typename _T2, typename _U1, typename _U2>
-  constexpr bool _ConstructiblePair()
-  {
-    return __and_<__or_<is_same<typename decay<_T1>::type,
-				typename decay<_U1>::type>,
-			is_constructible<_T1, const _U1&>>,
-		  __or_<is_same<typename decay<_T2>::type,
-				typename decay<_U2>::type>,
-			is_constructible<_T2, const _U2&>>>::value;
-  }
-
-  template <typename _T1, typename _T2, typename _U1, typename _U2>
-  constexpr bool _ImplicitlyConvertiblePair()
-  {
-    return __and_<__or_<is_same<typename decay<_T1>::type,
-				typename decay<_U1>::type>,
-			is_convertible<const _U1&, _T1>>,
-		  __or_<is_same<typename decay<_T2>::type,
-				typename decay<_U2>::type>,
-		       is_convertible<const _U2&, _T2>>>::value;
-  }
-
-  template <typename _T1, typename _T2, typename _U1, typename _U2>
-  constexpr bool _MoveConstructiblePair()
-  {
-    return __and_<__or_<is_same<typename decay<_T1>::type,
-				typename decay<_U1>::type>,
-			is_constructible<_T1, _U1&&>>,
-		  __or_<is_same<typename decay<_T2>::type,
-				typename decay<_U2>::type>,
-			is_constructible<_T2, _U2&&>>>::value;
-  }
-
-  template <typename _T1, typename _T2, typename _U1, typename _U2>
-  constexpr bool _ImplicitlyMoveConvertiblePair()
-  {
-    return __and_<__or_<is_same<typename decay<_T1>::type,
-				typename decay<_U1>::type>,
-			is_convertible<_U1&&, _T1>>,
-		  __or_<is_same<typename decay<_T2>::type,
-				typename decay<_U2>::type>,
-		       is_convertible<_U2&&, _T2>>>::value;
-  }
+  template <bool, typename _T1, typename _T2>
+    struct _PCC
+    {
+      template <typename _U1, typename _U2>
+      static constexpr bool _ConstructiblePair()
+      {
+	return __and_<is_constructible<_T1, const _U1&>,
+		      is_constructible<_T2, const _U2&>>::value;
+      }
+
+      template <typename _U1, typename _U2>
+      static constexpr bool _ImplicitlyConvertiblePair()
+      {
+	return __and_<is_convertible<const _U1&, _T1>,
+		      is_convertible<const _U2&, _T2>>::value;
+      }
+
+      template <typename _U1, typename _U2>
+      static constexpr bool _MoveConstructiblePair()
+      {
+	return __and_<is_constructible<_T1, _U1&&>,
+		      is_constructible<_T2, _U2&&>>::value;
+      }
 
+      template <typename _U1, typename _U2>
+      static constexpr bool _ImplicitlyMoveConvertiblePair()
+      {
+	return __and_<is_convertible<_U1&&, _T1>,
+		      is_convertible<_U2&&, _T2>>::value;
+      }
+
+      template <bool __implicit, typename _U1, typename _U2>
+      static constexpr bool _CopyMovePair()
+      {
+	using __do_converts = __and_<is_convertible<const _U1&, _T1>,
+				  is_convertible<_U2&&, _T2>>;
+	using __converts = typename conditional<__implicit,
+				       __do_converts,
+				       __not_<__do_converts>>::type;
+	return __and_<is_constructible<_T1, const _U1&>,
+		      is_constructible<_T2, _U2&&>,
+		      __converts
+		      >::value;
+      }
+
+      template <bool __implicit, typename _U1, typename _U2>
+      static constexpr bool _MoveCopyPair()
+      {
+	using __do_converts = __and_<is_convertible<_U1&&, _T1>,
+				  is_convertible<const _U2&, _T2>>;
+	using __converts = typename conditional<__implicit,
+				       __do_converts,
+				       __not_<__do_converts>>::type;
+	return __and_<is_constructible<_T1, _U1&&>,
+		      is_constructible<_T2, const _U2&&>,
+		      __converts
+		      >::value;
+      }
+  };
+
+  template <typename _T1, typename _T2>
+    struct _PCC<false, _T1, _T2>
+    {
+      template <typename _U1, typename _U2>
+      static constexpr bool _ConstructiblePair()
+      {
+	return false;
+      }
+
+      template <typename _U1, typename _U2>
+      static constexpr bool _ImplicitlyConvertiblePair()
+      {
+	return false;
+      }
+
+      template <typename _U1, typename _U2>
+      static constexpr bool _MoveConstructiblePair()
+      {
+	return false;
+      }
+
+      template <typename _U1, typename _U2>
+      static constexpr bool _ImplicitlyMoveConvertiblePair()
+      {
+	return false;
+      }
+  };
 
 #endif
 
@@ -186,16 +229,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       pair(const _T1& __a, const _T2& __b)
       : first(__a), second(__b) { }
 #else
+      // Shortcut for constraining the templates that don't take pairs.
+      using _PCCP = _PCC<true, _T1, _T2>;
+
       template<typename _U1 = _T1, typename _U2=_T2, typename
-                enable_if<_ConstructiblePair<_T1, _T2, _U1, _U2>()
-                         && _ImplicitlyConvertiblePair<_T1, _T2, _U1, _U2>(),
+	       enable_if<_PCCP::template
+			   _ConstructiblePair<_U1, _U2>()
+	                 && _PCCP::template
+			   _ImplicitlyConvertiblePair<_U1, _U2>(),
                          bool>::type=true>
       constexpr pair(const _T1& __a, const _T2& __b)
       : first(__a), second(__b) { }
 
        template<typename _U1 = _T1, typename _U2=_T2, typename
-	       enable_if<_ConstructiblePair<_T1, _T2, _U1, _U2>()
-                         && !_ImplicitlyConvertiblePair<_T1, _T2, _U1, _U2>(),
+		enable_if<_PCCP::template
+			    _ConstructiblePair<_U1, _U2>()
+	                  && !_PCCP::template
+			    _ImplicitlyConvertiblePair<_U1, _U2>(),
                          bool>::type=false>
       explicit constexpr pair(const _T1& __a, const _T2& __b)
       : first(__a), second(__b) { }
@@ -207,16 +257,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	pair(const pair<_U1, _U2>& __p)
 	: first(__p.first), second(__p.second) { }
 #else
+      // Shortcut for constraining the templates that take pairs.
+      template <typename _U1, typename _U2>
+        using _PCCFP = _PCC<!is_same<_T1, _U1>::value
+			    || !is_same<_T2, _U2>::value,
+			    _T1, _T2>;
+
       template<typename _U1, typename _U2, typename
-	       enable_if<_ConstructiblePair<_T1, _T2, _U1, _U2>()
-                         && _ImplicitlyConvertiblePair<_T1, _T2, _U1, _U2>(),
-                         bool>::type=true>
+	       enable_if<_PCCFP<_U1, _U2>::template
+			   _ConstructiblePair<_U1, _U2>()
+	                 && _PCCFP<_U1, _U2>::template
+			   _ImplicitlyConvertiblePair<_U1, _U2>(),
+			  bool>::type=true>
         constexpr pair(const pair<_U1, _U2>& __p)
         : first(__p.first), second(__p.second) { }
 
       template<typename _U1, typename _U2, typename
-               enable_if<_ConstructiblePair<_T1, _T2, _U1, _U2>()
-                         && !_ImplicitlyConvertiblePair<_T1, _T2, _U1, _U2>(),
+	       enable_if<_PCCFP<_U1, _U2>::template
+			   _ConstructiblePair<_U1, _U2>()
+			 && !_PCCFP<_U1, _U2>::template
+			   _ImplicitlyConvertiblePair<_U1, _U2>(),
                          bool>::type=false>
 	explicit constexpr pair(const pair<_U1, _U2>& __p)
 	: first(__p.first), second(__p.second) { }
@@ -226,75 +286,67 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       // DR 811.
       template<typename _U1, typename
-               enable_if<_ConstructiblePair<_T2, _T2, _T2, _T2>()
-                         && _MoveConstructiblePair<_T1, _T2, _U1, _T2>()
-                         && _ImplicitlyConvertiblePair<_T2, _T2, _T2, _T2>()
-                         && _ImplicitlyMoveConvertiblePair<_T1, _T2,
-							  _U1, _T2>(),
+	       enable_if<_PCCP::template
+			   _MoveCopyPair<true, _U1, _T2>(),
                          bool>::type=true>
        constexpr pair(_U1&& __x, const _T2& __y)
        : first(std::forward<_U1>(__x)), second(__y) { }
 
       template<typename _U1, typename
-               enable_if<_ConstructiblePair<_T2, _T2, _T2, _T2>()
-                         && _MoveConstructiblePair<_T1, _T2, _U1, _T2>()
-                         && (!_ImplicitlyConvertiblePair<_T2, _T2, _T2, _T2>()
-                             || !_ImplicitlyMoveConvertiblePair<_T1, _T2,
-                                                                _U1, _T2>()),
+	       enable_if<_PCCP::template
+			   _MoveCopyPair<false, _U1, _T2>(),
                          bool>::type=false>
        explicit constexpr pair(_U1&& __x, const _T2& __y)
        : first(std::forward<_U1>(__x)), second(__y) { }
 
       template<typename _U2, typename
-               enable_if<_ConstructiblePair<_T1, _T1, _T1, _T1>()
-                         && _MoveConstructiblePair<_T1, _T2, _T1, _U2>()
-                         && _ImplicitlyConvertiblePair<_T1, _T1, _T1, _T1>()
-                         && _ImplicitlyMoveConvertiblePair<_T1, _T2,
-                                                           _T1, _U2>(),
+	       enable_if<_PCCP::template
+			   _CopyMovePair<true, _T1, _U2>(),
                          bool>::type=true>
        constexpr pair(const _T1& __x, _U2&& __y)
        : first(__x), second(std::forward<_U2>(__y)) { }
 
       template<typename _U2, typename
-               enable_if<_ConstructiblePair<_T1, _T1, _T1, _T1>()
-                         && _MoveConstructiblePair<_T1, _T2, _T1, _U2>()
-                         && (!_ImplicitlyConvertiblePair<_T1, _T1, _T1, _T1>()
-                             || !_ImplicitlyMoveConvertiblePair<_T1, _T2,
-                                                                _T1, _U2>()),
+	       enable_if<_PCCP::template
+			   _CopyMovePair<false, _T1, _U2>(),
                          bool>::type=false>
        explicit pair(const _T1& __x, _U2&& __y)
        : first(__x), second(std::forward<_U2>(__y)) { }
 
       template<typename _U1, typename _U2, typename
-	       enable_if<_MoveConstructiblePair<_T1, _T2, _U1, _U2>()
-                         && _ImplicitlyMoveConvertiblePair<_T1, _T2,
-							   _U1, _U2>(),
+	       enable_if<_PCCP::template
+			   _MoveConstructiblePair<_U1, _U2>()
+			  && _PCCP::template
+			   _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
                          bool>::type=true>
 	constexpr pair(_U1&& __x, _U2&& __y)
 	: first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
 
       template<typename _U1, typename _U2, typename
-	       enable_if<_MoveConstructiblePair<_T1, _T2, _U1, _U2>()
-                         && !_ImplicitlyMoveConvertiblePair<_T1, _T2,
-							    _U1, _U2>(),
+	       enable_if<_PCCP::template
+			   _MoveConstructiblePair<_U1, _U2>()
+			  && !_PCCP::template
+			   _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
                          bool>::type=false>
 	explicit constexpr pair(_U1&& __x, _U2&& __y)
 	: first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
 
 
       template<typename _U1, typename _U2, typename
-	       enable_if<_MoveConstructiblePair<_T1, _T2, _U1, _U2>()
-                         && _ImplicitlyMoveConvertiblePair<_T1, _T2,
-							   _U1, _U2>(),
+	       enable_if<_PCCFP<_U1, _U2>::template
+			   _MoveConstructiblePair<_U1, _U2>()
+			  && _PCCFP<_U1, _U2>::template
+			   _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
                          bool>::type=true>
 	constexpr pair(pair<_U1, _U2>&& __p)
 	: first(std::forward<_U1>(__p.first)),
 	  second(std::forward<_U2>(__p.second)) { }
 
       template<typename _U1, typename _U2, typename
-	       enable_if<_MoveConstructiblePair<_T1, _T2, _U1, _U2>()
-                         && !_ImplicitlyMoveConvertiblePair<_T1, _T2,
-							   _U1, _U2>(),
+	       enable_if<_PCCFP<_U1, _U2>::template
+			   _MoveConstructiblePair<_U1, _U2>()
+			  && !_PCCFP<_U1, _U2>::template
+			   _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
                          bool>::type=false>
 	explicit constexpr pair(pair<_U1, _U2>&& __p)
 	: first(std::forward<_U1>(__p.first)),
@@ -304,7 +356,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
         pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>);
 
       pair&
-      operator=(const pair& __p)
+      operator=(typename conditional<
+		__and_<is_copy_assignable<_T1>,
+		       is_copy_assignable<_T2>>::value,
+		const pair&, const __nonesuch&>::type __p)
       {
 	first = __p.first;
 	second = __p.second;
@@ -312,7 +367,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       }
 
       pair&
-      operator=(pair&& __p)
+      operator=(typename conditional<
+		__not_<__and_<is_copy_assignable<_T1>,
+		              is_copy_assignable<_T2>>>::value,
+		const pair&, const __nonesuch&>::type __p) = delete;
+
+      pair&
+      operator=(typename conditional<
+		__and_<is_move_assignable<_T1>,
+		       is_move_assignable<_T2>>::value,
+		pair&&, __nonesuch&&>::type __p)
       noexcept(__and_<is_nothrow_move_assignable<_T1>,
 	              is_nothrow_move_assignable<_T2>>::value)
       {
@@ -322,7 +386,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       }
 
       template<typename _U1, typename _U2>
-	pair&
+      typename enable_if<__and_<is_assignable<_T1&, const _U1&>,
+				is_assignable<_T2&, const _U2&>>::value,
+			 pair&>::type
 	operator=(const pair<_U1, _U2>& __p)
 	{
 	  first = __p.first;
@@ -331,7 +397,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	}
 
       template<typename _U1, typename _U2>
-	pair&
+      typename enable_if<__and_<is_assignable<_T1&, _U1&&>,
+				is_assignable<_T2&, _U2&&>>::value,
+			 pair&>::type
 	operator=(pair<_U1, _U2>&& __p)
 	{
 	  first = std::forward<_U1>(__p.first);
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index baa4d1f..e12403b 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -2846,6 +2846,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
              __call_is_nothrow<result_of<_Fn(_Args...)>, _Fn, _Args...>>::type
     { };
 
+  struct __nonesuch {
+    __nonesuch() = delete;
+    ~__nonesuch() = delete;
+    __nonesuch(__nonesuch const&) = delete;
+    void operator=(__nonesuch const&) = delete;
+  };
+
 #if __cplusplus > 201402L
 # define __cpp_lib_is_callable 201603
 
diff --git a/libstdc++-v3/testsuite/20_util/pair/traits.cc b/libstdc++-v3/testsuite/20_util/pair/traits.cc
new file mode 100644
index 0000000..0989cf1
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/pair/traits.cc
@@ -0,0 +1,77 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++11" }
+
+// Copyright (C) 2016 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <utility>
+
+#include <type_traits>
+#include <memory>
+
+using namespace std;
+
+struct Poison
+{
+	Poison(Poison&&) = delete;
+};
+
+struct ThrowingCopy
+{
+  ThrowingCopy(const ThrowingCopy&) {}
+  ThrowingCopy& operator=(const ThrowingCopy&) {}
+};
+
+int main()
+{
+	static_assert(!is_copy_constructible<Poison>::value, "");
+	static_assert(!is_move_constructible<Poison>::value, "");
+	static_assert(!is_copy_assignable<Poison>::value, "");
+	static_assert(!is_move_assignable<Poison>::value, "");
+	static_assert(!is_copy_constructible<std::pair<int, Poison>>::value,
+		      "");
+	static_assert(!is_move_constructible<std::pair<int, Poison>>::value,
+		      "");
+	static_assert(!is_copy_assignable<std::pair<int, Poison>>::value, "");
+	static_assert(!is_move_assignable<std::pair<int, Poison>>::value, "");
+	static_assert(!is_constructible<std::pair<int, Poison>&,
+		      std::pair<char, Poison>&>::value, "");
+	static_assert(!is_assignable<std::pair<int, Poison>&,
+		      std::pair<char, Poison>&>::value, "");
+	static_assert(!is_constructible<std::pair<int, Poison>&,
+		      std::pair<char, Poison>>::value, "");
+	static_assert(!is_assignable<std::pair<int, Poison>&,
+		      std::pair<char, Poison>>::value, "");
+	static_assert(!is_copy_constructible<std::pair<ThrowingCopy,
+		      std::unique_ptr<int>>>::value,
+		      "");
+	static_assert(is_move_constructible<std::pair<ThrowingCopy,
+		      std::unique_ptr<int>>>::value,
+		      "");
+	static_assert(!is_nothrow_move_constructible<std::pair<ThrowingCopy,
+		      std::unique_ptr<int>>>::value,
+		      "");
+	static_assert(!is_copy_assignable<std::pair<ThrowingCopy,
+		      std::unique_ptr<int>>>::value,
+		      "");
+	static_assert(is_move_assignable<std::pair<ThrowingCopy,
+		      std::unique_ptr<int>>>::value,
+		      "");
+	static_assert(!is_nothrow_move_assignable<std::pair<ThrowingCopy,
+		      std::unique_ptr<int>>>::value,
+		      "");
+}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [v3 PATCH] Implement LWG 2729 for pair.
  2016-08-17  4:41 [v3 PATCH] Implement LWG 2729 for pair Ville Voutilainen
@ 2016-09-21 10:52 ` Jonathan Wakely
  2016-09-24 18:39   ` Ville Voutilainen
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Wakely @ 2016-09-21 10:52 UTC (permalink / raw)
  To: Ville Voutilainen; +Cc: libstdc++, gcc-patches

On 17/08/16 07:41 +0300, Ville Voutilainen wrote:
>    Implement LWG 2729 for pair.
>    * include/bits/stl_pair.h (_PCC): New.
>    (_ConstructiblePair, _ImplicitlyConvertiblePair):
>    Turn into static member functions of _PCC.
>    (_MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): Likewise.
>    (_PCCP): New.
>    (pair(const _T1&, const _T2&)): Adjust.
>    (_PCCFP): New.
>    (pair(const pair<_U1, _U2>&)): Adjust.
>    (pair(_U1&&, const _T2&)): Likewise.
>    (pair(const _T1&, _U2&&)): Likewise.
>    (pair(_U1&&, _U2&&)): Likewise.
>    (pair(pair<_U1, _U2>&&)): Likewise.
>    (operator=(const pair&)): Make conditionally deleted.
>    (operator=(pair&&)): Make conditionally suppressed.
>    (operator=(const pair<_U1, _U2>&)): Constrain.
>    (operator=(pair<_U1, _U2>&&): Likewise.
>    * include/std/type_traits (__nonesuch): New.
>    * testsuite/20_util/pair/traits.cc: Likewise.

I found the "Likewise" a bit confusing here. I realise it means "New"
but my first thought was it meant you were adding __nonesuch to that
test file. "New" for the test would be unambiguous :-)

>diff --git a/libstdc++-v3/testsuite/20_util/pair/traits.cc b/libstdc++-v3/testsuite/20_util/pair/traits.cc
>new file mode 100644
>index 0000000..0989cf1
>--- /dev/null
>+++ b/libstdc++-v3/testsuite/20_util/pair/traits.cc
>@@ -0,0 +1,77 @@
>+// { dg-do compile }
>+// { dg-options "-std=gnu++11" }

This patch predates my testsuite changes, so this should now be
{ dg-do compile { target c++11 } } 

Otherwise OK for trunk, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [v3 PATCH] Implement LWG 2729 for pair.
  2016-09-21 10:52 ` Jonathan Wakely
@ 2016-09-24 18:39   ` Ville Voutilainen
  2016-09-26 13:08     ` Jonathan Wakely
  0 siblings, 1 reply; 7+ messages in thread
From: Ville Voutilainen @ 2016-09-24 18:39 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

On 21 September 2016 at 13:33, Jonathan Wakely <jwakely@redhat.com> wrote:
> This patch predates my testsuite changes, so this should now be
> { dg-do compile { target c++11 } }
> Otherwise OK for trunk, thanks.


So, this has been applied to trunk, and also applies cleanly to the
gcc-6 branch, and we need
to backport it to fix PR libstdc++/77537. Ok for the gcc-6 branch?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [v3 PATCH] Implement LWG 2729 for pair.
  2016-09-24 18:39   ` Ville Voutilainen
@ 2016-09-26 13:08     ` Jonathan Wakely
  2016-09-27  0:34       ` Christophe Lyon
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Wakely @ 2016-09-26 13:08 UTC (permalink / raw)
  To: Ville Voutilainen; +Cc: libstdc++, gcc-patches

On 24/09/16 21:13 +0300, Ville Voutilainen wrote:
>So, this has been applied to trunk, and also applies cleanly to the
>gcc-6 branch, and we need
>to backport it to fix PR libstdc++/77537. Ok for the gcc-6 branch?

Yes, OK for gcc-6-branch too, as it fixes a regression since 5.x


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [v3 PATCH] Implement LWG 2729 for pair.
  2016-09-26 13:08     ` Jonathan Wakely
@ 2016-09-27  0:34       ` Christophe Lyon
  2016-09-27  0:38         ` Ville Voutilainen
  0 siblings, 1 reply; 7+ messages in thread
From: Christophe Lyon @ 2016-09-27  0:34 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Ville Voutilainen, libstdc++, gcc-patches

Hi,


On 26 September 2016 at 14:54, Jonathan Wakely <jwakely@redhat.com> wrote:
> On 24/09/16 21:13 +0300, Ville Voutilainen wrote:
>>
>> So, this has been applied to trunk, and also applies cleanly to the
>> gcc-6 branch, and we need
>> to backport it to fix PR libstdc++/77537. Ok for the gcc-6 branch?
>
>
> Yes, OK for gcc-6-branch too, as it fixes a regression since 5.x
>
>

I'm seeing regressions on the gcc-6-branch since this was committed,
on arm and aarch64 targets.
  - PASS now FAIL             [PASS => FAIL]:

  20_util/declval/requirements/1_neg.cc  (test for errors, line 2263)
  20_util/declval/requirements/1_neg.cc (test for excess errors)
  20_util/make_signed/requirements/typedefs_neg.cc  (test for errors, line 1928)
  20_util/make_signed/requirements/typedefs_neg.cc (test for excess errors)
  20_util/make_unsigned/requirements/typedefs_neg.cc  (test for
errors, line 1781)
  20_util/make_unsigned/requirements/typedefs_neg.cc  (test for
errors, line 1824)
  20_util/make_unsigned/requirements/typedefs_neg.cc (test for excess errors)

Error messages include:
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64-none-linux-gnu/gcc3/aarch64-none-linux-gnu/libstdc++-v3/include/type_traits:2270:
error: static assertion failed: declval() must not be used!

Is it just because the pattern in dg-error is *-*-* ?

Christophe

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [v3 PATCH] Implement LWG 2729 for pair.
  2016-09-27  0:34       ` Christophe Lyon
@ 2016-09-27  0:38         ` Ville Voutilainen
  2016-09-27  4:52           ` Ville Voutilainen
  0 siblings, 1 reply; 7+ messages in thread
From: Ville Voutilainen @ 2016-09-27  0:38 UTC (permalink / raw)
  To: Christophe Lyon; +Cc: Jonathan Wakely, libstdc++, gcc-patches

On 27 September 2016 at 03:16, Christophe Lyon
<christophe.lyon@linaro.org> wrote:
>   20_util/declval/requirements/1_neg.cc  (test for errors, line 2263)
>   20_util/declval/requirements/1_neg.cc (test for excess errors)
>   20_util/make_signed/requirements/typedefs_neg.cc  (test for errors, line 1928)
>   20_util/make_signed/requirements/typedefs_neg.cc (test for excess errors)
>   20_util/make_unsigned/requirements/typedefs_neg.cc  (test for
> errors, line 1781)
>   20_util/make_unsigned/requirements/typedefs_neg.cc  (test for
> errors, line 1824)
>   20_util/make_unsigned/requirements/typedefs_neg.cc (test for excess errors)
>
> Error messages include:
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64-none-linux-gnu/gcc3/aarch64-none-linux-gnu/libstdc++-v3/include/type_traits:2270:
> error: static assertion failed: declval() must not be used!
>
> Is it just because the pattern in dg-error is *-*-* ?


Argh, I'll take a look. These errors come from the testsuite expecting
certain line numbers in certain
library headers, and adding code to said headers shifts the error lines.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [v3 PATCH] Implement LWG 2729 for pair.
  2016-09-27  0:38         ` Ville Voutilainen
@ 2016-09-27  4:52           ` Ville Voutilainen
  0 siblings, 0 replies; 7+ messages in thread
From: Ville Voutilainen @ 2016-09-27  4:52 UTC (permalink / raw)
  To: Christophe Lyon; +Cc: Jonathan Wakely, libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1319 bytes --]

On 27 September 2016 at 03:21, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
> On 27 September 2016 at 03:16, Christophe Lyon
> <christophe.lyon@linaro.org> wrote:
>>   20_util/declval/requirements/1_neg.cc  (test for errors, line 2263)
>>   20_util/declval/requirements/1_neg.cc (test for excess errors)
>>   20_util/make_signed/requirements/typedefs_neg.cc  (test for errors, line 1928)
>>   20_util/make_signed/requirements/typedefs_neg.cc (test for excess errors)
>>   20_util/make_unsigned/requirements/typedefs_neg.cc  (test for
>> errors, line 1781)
>>   20_util/make_unsigned/requirements/typedefs_neg.cc  (test for
>> errors, line 1824)
>>   20_util/make_unsigned/requirements/typedefs_neg.cc (test for excess errors)
>>
>> Error messages include:
>> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64-none-linux-gnu/gcc3/aarch64-none-linux-gnu/libstdc++-v3/include/type_traits:2270:
>> error: static assertion failed: declval() must not be used!
>>
>> Is it just because the pattern in dg-error is *-*-* ?
>
>
> Argh, I'll take a look. These errors come from the testsuite expecting
> certain line numbers in certain
> library headers, and adding code to said headers shifts the error lines.

I have committed the attached patch as obvious. Pardons all around for
failing to run the full suite properly.

[-- Attachment #2: fix-lwg2729-backport-testsuite-failures.diff --]
[-- Type: text/plain, Size: 2003 bytes --]

diff --git a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
index f2a0dbf..9989a79 100644
--- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
@@ -19,7 +19,7 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// { dg-error "static assertion failed" "" { target *-*-* } 2263 }
+// { dg-error "static assertion failed" "" { target *-*-* } 2270 }
 
 #include <utility>
 
diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
index 6914eb4..3a097c3 100644
--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
@@ -48,4 +48,4 @@ void test01()
 // { dg-error "required from here" "" { target *-*-* } 40 }
 // { dg-error "required from here" "" { target *-*-* } 42 }
 
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1928 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1935 }
diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
index 81ff92a..4e64166 100644
--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
@@ -48,5 +48,5 @@ void test01()
 // { dg-error "required from here" "" { target *-*-* } 40 }
 // { dg-error "required from here" "" { target *-*-* } 42 }
 
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1824 }
-// { dg-error "declaration of" "" { target *-*-* } 1781 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1831 }
+// { dg-error "declaration of" "" { target *-*-* } 1788 }

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-09-27  0:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-17  4:41 [v3 PATCH] Implement LWG 2729 for pair Ville Voutilainen
2016-09-21 10:52 ` Jonathan Wakely
2016-09-24 18:39   ` Ville Voutilainen
2016-09-26 13:08     ` Jonathan Wakely
2016-09-27  0:34       ` Christophe Lyon
2016-09-27  0:38         ` Ville Voutilainen
2016-09-27  4:52           ` Ville Voutilainen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).