public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [v3 PATCH] Fix testsuite failures caused by the patch implementing LWG 2534.
@ 2016-11-30 15:58 Ville Voutilainen
  2016-11-30 16:25 ` Jonathan Wakely
  0 siblings, 1 reply; 7+ messages in thread
From: Ville Voutilainen @ 2016-11-30 15:58 UTC (permalink / raw)
  To: libstdc++, gcc-patches

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

2016-11-30  Ville Voutilainen  <ville.voutilainen@gmail.com>

    Fix testsuite failures caused by the patch implementing LWG 2534.
    * include/std/istream (__is_convertible_to_basic_istream):
    Change the return types of __check, introduce stream_type.
    (operator>>(_Istream&&, _Tp&&)):
    Use __is_convertible_to_basic_istream::stream_type as the return type.
    * include/std/ostream (__is_convertible_to_basic_ostream):
    Change the return types of __check, introduce stream_type.
    (operator>>(_Ostream&&, _Tp&&)):
    Use __is_convertible_to_basic_ostream::stream_type as the return type.

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

diff --git a/libstdc++-v3/include/std/istream b/libstdc++-v3/include/std/istream
index 4f0e940..81df402 100644
--- a/libstdc++-v3/include/std/istream
+++ b/libstdc++-v3/include/std/istream
@@ -913,11 +913,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     struct __is_convertible_to_basic_istream
     {
       template<typename _Ch, typename _Up>
-      static true_type __check(basic_istream<_Ch, _Up>*);
+      static basic_istream<_Ch, _Up>& __check(basic_istream<_Ch, _Up>*);
 
-      static false_type __check(void*);
+      static void __check(void*);
     public:
-      using type = decltype(__check(declval<_Tp*>()));
+      using stream_type = decltype(__check(declval<_Tp*>()));
+      using type = __not_<is_same<stream_type, void>>;
       constexpr static bool value = type::value;
   };
 
@@ -949,7 +950,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 			      __is_convertible_to_basic_istream<
 				typename remove_reference<_Istream>::type>,
 			      __is_extractable<_Istream&, _Tp&&>>::value,
-		       _Istream&>::type
+		       typename __is_convertible_to_basic_istream<
+			 typename
+			 remove_reference<_Istream>::type>::stream_type>::type
     operator>>(_Istream&& __is, _Tp&& __x)
     {
       __is >> std::forward<_Tp>(__x);
diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream
index a1fe892..64db7c7 100644
--- a/libstdc++-v3/include/std/ostream
+++ b/libstdc++-v3/include/std/ostream
@@ -617,11 +617,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     struct __is_convertible_to_basic_ostream
   {
     template<typename _Ch, typename _Up>
-    static true_type __check(basic_ostream<_Ch, _Up>*);
+    static basic_ostream<_Ch, _Up>& __check(basic_ostream<_Ch, _Up>*);
 
-    static false_type __check(void*);
+    static void __check(void*);
   public:
-    using type = decltype(__check(declval<_Tp*>()));
+    using stream_type = decltype(__check(declval<_Tp*>()));
+    using type = __not_<is_same<stream_type, void>>;
     constexpr static bool value = type::value;
   };
 
@@ -650,8 +651,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 			      __is_convertible_to_basic_ostream<
 				typename remove_reference<_Ostream>::type>,
 			      __is_insertable<_Ostream&, const _Tp&>>::value,
-		       _Ostream&>::type
-				      //basic_ostream<_CharT, _Traits>&
+		       typename __is_convertible_to_basic_ostream<
+			 typename
+			 remove_reference<_Ostream>::type>::stream_type>::type
     operator<<(_Ostream&& __os, const _Tp& __x)
     {
       __os << __x;

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

* Re: [v3 PATCH] Fix testsuite failures caused by the patch implementing LWG 2534.
  2016-11-30 15:58 [v3 PATCH] Fix testsuite failures caused by the patch implementing LWG 2534 Ville Voutilainen
@ 2016-11-30 16:25 ` Jonathan Wakely
  2016-12-01  5:38   ` Markus Trippelsdorf
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Wakely @ 2016-11-30 16:25 UTC (permalink / raw)
  To: Ville Voutilainen; +Cc: libstdc++, gcc-patches

On 30/11/16 17:58 +0200, Ville Voutilainen wrote:
>    Fix testsuite failures caused by the patch implementing LWG 2534.
>    * include/std/istream (__is_convertible_to_basic_istream):
>    Change the return types of __check, introduce stream_type.
>    (operator>>(_Istream&&, _Tp&&)):
>    Use __is_convertible_to_basic_istream::stream_type as the return type.
>    * include/std/ostream (__is_convertible_to_basic_ostream):
>    Change the return types of __check, introduce stream_type.
>    (operator>>(_Ostream&&, _Tp&&)):
>    Use __is_convertible_to_basic_ostream::stream_type as the return type.

As discussed on IRC, please change "stream_type" to istream_type and
ostream_type, as appropriate, because those names are already used by
stream iterators, so users can't define them as macros.

And you could make the remove_reference happen inside the
__is_convertible_to_basic_[io]stream trait, since it's only ever used
with references, but that seems stylistic.

OK with the stream_type renaming.


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

* Re: [v3 PATCH] Fix testsuite failures caused by the patch implementing LWG 2534.
  2016-11-30 16:25 ` Jonathan Wakely
@ 2016-12-01  5:38   ` Markus Trippelsdorf
  2016-12-01  6:11     ` Ville Voutilainen
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Trippelsdorf @ 2016-12-01  5:38 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Ville Voutilainen, libstdc++, gcc-patches

On 2016.11.30 at 16:25 +0000, Jonathan Wakely wrote:
> On 30/11/16 17:58 +0200, Ville Voutilainen wrote:
> >    Fix testsuite failures caused by the patch implementing LWG 2534.
> >    * include/std/istream (__is_convertible_to_basic_istream):
> >    Change the return types of __check, introduce stream_type.
> >    (operator>>(_Istream&&, _Tp&&)):
> >    Use __is_convertible_to_basic_istream::stream_type as the return type.
> >    * include/std/ostream (__is_convertible_to_basic_ostream):
> >    Change the return types of __check, introduce stream_type.
> >    (operator>>(_Ostream&&, _Tp&&)):
> >    Use __is_convertible_to_basic_ostream::stream_type as the return type.
> 
> As discussed on IRC, please change "stream_type" to istream_type and
> ostream_type, as appropriate, because those names are already used by
> stream iterators, so users can't define them as macros.
> 
> And you could make the remove_reference happen inside the
> __is_convertible_to_basic_[io]stream trait, since it's only ever used
> with references, but that seems stylistic.
> 
> OK with the stream_type renaming.

It breaks building Firefox:

In file included from ../../dist/system_wrappers/ostream:4:0,
                 from ../../dist/stl_wrappers/ostream:55,
                 from /home/trippels/gcc_test/usr/local/include/c++/7.0.0/iterator:64,
                 from ../../dist/system_wrappers/iterator:4,
                 from ../../dist/stl_wrappers/iterator:55,
                 from /home/trippels/gcc_test/usr/local/include/c++/7.0.0/backward/hashtable.h:63,
                 from /home/trippels/gcc_test/usr/local/include/c++/7.0.0/ext/hash_map:64,
                 from /home/trippels/gecko-dev/ipc/chromium/src/base/hash_tables.h:43,
                 from /home/trippels/gecko-dev/ipc/chromium/src/base/file_path.h:72,
                 from /home/trippels/gecko-dev/ipc/chromium/src/chrome/common/ipc_message_utils.h:12,
                 from ../../dist/include/ipc/IPCMessageUtils.h:11,
                 from ../../dist/include/mozilla/ipc/Transport_posix.h:11,
                 from ../../dist/include/mozilla/ipc/Transport.h:15,
                 from /home/trippels/gecko-dev/ipc/glue/BackgroundChild.h:10,
                 from /home/trippels/gecko-dev/ipc/glue/BackgroundImpl.cpp:5,
                 from /home/trippels/moz-build-dir/ipc/glue/Unified_cpp_ipc_glue0.cpp:2:
/home/trippels/gcc_test/usr/local/include/c++/7.0.0/ostream: In instantiation of ‘struct std::__is_convertible_to_basic_ostream<const mozilla::unused_t&>’:
/home/trippels/gcc_test/usr/local/include/c++/7.0.0/ostream:656:5:   required by substitution of ‘template<class _Ostream, class _Tp> typename std::enable_if<std::__and_<std::__not_<std::is_lvalue_reference<_Tp> >, std::__is_convertible_to_basic_ostream<_Ostream>, std::__is_insertable<_Ostream&, const _Tp&, void> >::value, typename std::__is_convertible_to_basic_ostream<_Tp>::ostream_type>::type std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = const mozilla::unused_t&; _Tp = {anonymous}::ParentImpl*]’
../../dist/include/nsCOMPtr.h:185:13:   required from ‘void operator<<(const mozilla::unused_t&, const already_AddRefed<{anonymous}::ParentImpl>&)’
/home/trippels/gecko-dev/ipc/glue/BackgroundImpl.cpp:1981:32:   required from here
/home/trippels/gcc_test/usr/local/include/c++/7.0.0/ostream:625:23: error: no matching function for call to ‘std::__is_convertible_to_basic_ostream<const mozilla::unused_t&>::__check(const mozilla::unused_t*)’
       decltype(__check(declval<typename remove_reference<_Tp>::type*>()));
                ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/trippels/gcc_test/usr/local/include/c++/7.0.0/ostream:620:37: note: candidate: template<class _Ch, class _Up> static std::basic_ostream<_Ch, _Up>& std::__is_convertible_to_basic_ostream<_Tp>::__check(std::basic_ostream<_Ch, _Up>*) [with _Ch = _Ch; _Up = _Up; _Tp = const mozilla::unused_t&]
     static basic_ostream<_Ch, _Up>& __check(basic_ostream<_Ch, _Up>*);
                                     ^~~~~~~
/home/trippels/gcc_test/usr/local/include/c++/7.0.0/ostream:620:37: note:   template argument deduction/substitution failed:
/home/trippels/gcc_test/usr/local/include/c++/7.0.0/ostream:625:23: note:   types ‘std::basic_ostream<_CharT, _Traits>’ and ‘const mozilla::unused_t’ have incompatible cv-qualifiers
       decltype(__check(declval<typename remove_reference<_Tp>::type*>()));
                ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/trippels/gcc_test/usr/local/include/c++/7.0.0/ostream:622:17: note: candidate: static void std::__is_convertible_to_basic_ostream<_Tp>::__check(void*) [with _Tp = const mozilla::unused_t&] <near match>
     static void __check(void*);
                 ^~~~~~~
/home/trippels/gcc_test/usr/local/include/c++/7.0.0/ostream:622:17: note:   conversion of argument 1 would be ill-formed:
/home/trippels/gcc_test/usr/local/include/c++/7.0.0/ostream:625:23: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
       decltype(__check(declval<typename remove_reference<_Tp>::type*>()));
                ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/trippels/gcc_test/usr/local/include/c++/7.0.0/ostream:625:23: error: no matching function for call to ‘std::__is_convertible_to_basic_ostream<const mozilla::unused_t&>::__check(const mozilla::unused_t*)’
/home/trippels/gcc_test/usr/local/include/c++/7.0.0/ostream:620:37: note: candidate: template<class _Ch, class _Up> static std::basic_ostream<_Ch, _Up>& std::__is_convertible_to_basic_ostream<_Tp>::__check(std::basic_ostream<_Ch, _Up>*) [with _Ch = _Ch; _Up = _Up; _Tp = const mozilla::unused_t&]
     static basic_ostream<_Ch, _Up>& __check(basic_ostream<_Ch, _Up>*);
                                     ^~~~~~~
/home/trippels/gcc_test/usr/local/include/c++/7.0.0/ostream:620:37: note:   template argument deduction/substitution failed:
/home/trippels/gcc_test/usr/local/include/c++/7.0.0/ostream:625:23: note:   types ‘std::basic_ostream<_CharT, _Traits>’ and ‘const mozilla::unused_t’ have incompatible cv-qualifiers
       decltype(__check(declval<typename remove_reference<_Tp>::type*>()));
                ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

-- 
Markus

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

* Re: [v3 PATCH] Fix testsuite failures caused by the patch implementing LWG 2534.
  2016-12-01  5:38   ` Markus Trippelsdorf
@ 2016-12-01  6:11     ` Ville Voutilainen
  2016-12-01  6:45       ` Markus Trippelsdorf
  0 siblings, 1 reply; 7+ messages in thread
From: Ville Voutilainen @ 2016-12-01  6:11 UTC (permalink / raw)
  To: Markus Trippelsdorf; +Cc: Jonathan Wakely, libstdc++, gcc-patches

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

On 1 December 2016 at 07:38, Markus Trippelsdorf <markus@trippelsdorf.de> wrote:
> It breaks building Firefox:


Sigh, when writing a trait, write a proper trait. Does this patch fix
the problem?

2016-12-01  Ville Voutilainen  <ville.voutilainen@gmail.com>

    The convertible_to traits need to use a variadic catch-all for the
    false-cases.
    * include/std/istream (__is_convertible_to_basic_istream):
    Change the parameter of the false-case of __check to a variadic.
    * include/std/ostream (__is_convertible_to_basic_ostream):
    Likewise.

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

diff --git a/libstdc++-v3/include/std/istream b/libstdc++-v3/include/std/istream
index 319e226..1d77d30 100644
--- a/libstdc++-v3/include/std/istream
+++ b/libstdc++-v3/include/std/istream
@@ -915,7 +915,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       template<typename _Ch, typename _Up>
       static basic_istream<_Ch, _Up>& __check(basic_istream<_Ch, _Up>*);
 
-      static void __check(void*);
+      static void __check(...);
     public:
       using istream_type =
 	decltype(__check(declval<typename remove_reference<_Tp>::type*>()));
diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream
index 70fd10b..9dea778 100644
--- a/libstdc++-v3/include/std/ostream
+++ b/libstdc++-v3/include/std/ostream
@@ -619,7 +619,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     template<typename _Ch, typename _Up>
     static basic_ostream<_Ch, _Up>& __check(basic_ostream<_Ch, _Up>*);
 
-    static void __check(void*);
+    static void __check(...);
   public:
     using ostream_type =
       decltype(__check(declval<typename remove_reference<_Tp>::type*>()));

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

* Re: [v3 PATCH] Fix testsuite failures caused by the patch implementing LWG 2534.
  2016-12-01  6:11     ` Ville Voutilainen
@ 2016-12-01  6:45       ` Markus Trippelsdorf
  2016-12-01  7:14         ` Ville Voutilainen
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Trippelsdorf @ 2016-12-01  6:45 UTC (permalink / raw)
  To: Ville Voutilainen; +Cc: Jonathan Wakely, libstdc++, gcc-patches

On 2016.12.01 at 08:11 +0200, Ville Voutilainen wrote:
> On 1 December 2016 at 07:38, Markus Trippelsdorf <markus@trippelsdorf.de> wrote:
> > It breaks building Firefox:
> 
> Sigh, when writing a trait, write a proper trait. Does this patch fix
> the problem?

Yes it does. Thank you.

-- 
Markus

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

* Re: [v3 PATCH] Fix testsuite failures caused by the patch implementing LWG 2534.
  2016-12-01  6:45       ` Markus Trippelsdorf
@ 2016-12-01  7:14         ` Ville Voutilainen
  2016-12-01  7:17           ` Ville Voutilainen
  0 siblings, 1 reply; 7+ messages in thread
From: Ville Voutilainen @ 2016-12-01  7:14 UTC (permalink / raw)
  To: Markus Trippelsdorf; +Cc: Jonathan Wakely, libstdc++, gcc-patches

On 1 December 2016 at 08:45, Markus Trippelsdorf <markus@trippelsdorf.de> wrote:
> On 2016.12.01 at 08:11 +0200, Ville Voutilainen wrote:
>> On 1 December 2016 at 07:38, Markus Trippelsdorf <markus@trippelsdorf.de> wrote:
>> > It breaks building Firefox:
>>
>> Sigh, when writing a trait, write a proper trait. Does this patch fix
>> the problem?
>
> Yes it does. Thank you.


Committed as obvious-enough.

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

* Re: [v3 PATCH] Fix testsuite failures caused by the patch implementing LWG 2534.
  2016-12-01  7:14         ` Ville Voutilainen
@ 2016-12-01  7:17           ` Ville Voutilainen
  0 siblings, 0 replies; 7+ messages in thread
From: Ville Voutilainen @ 2016-12-01  7:17 UTC (permalink / raw)
  To: Markus Trippelsdorf; +Cc: Jonathan Wakely, libstdc++, gcc-patches

On 1 December 2016 at 09:14, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
>> Yes it does. Thank you.
> Committed as obvious-enough.

Also, if this change causes one more problem I'm reverting all of it,
we _are_ in stage 3 and this sort of churn
is not exactly desirable. I'm currently hiding in a basement so as to
avoid the wrath of release managers anyway. :)

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

end of thread, other threads:[~2016-12-01  7:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-30 15:58 [v3 PATCH] Fix testsuite failures caused by the patch implementing LWG 2534 Ville Voutilainen
2016-11-30 16:25 ` Jonathan Wakely
2016-12-01  5:38   ` Markus Trippelsdorf
2016-12-01  6:11     ` Ville Voutilainen
2016-12-01  6:45       ` Markus Trippelsdorf
2016-12-01  7:14         ` Ville Voutilainen
2016-12-01  7:17           ` 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).