public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/94203] New: experimental/executor and socket header issues-
@ 2020-03-17 16:16 erich.keane at intel dot com
  2020-03-17 16:53 ` [Bug libstdc++/94203] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: erich.keane at intel dot com @ 2020-03-17 16:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94203

            Bug ID: 94203
           Summary: experimental/executor and socket header issues-
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: erich.keane at intel dot com
  Target Milestone: ---

Again detected by trying to compile these headers with clang, I get two more
issues.  They can be reproduced here: https://godbolt.org/z/L-UVGq though that
still shows the previous version's issue with service_already_exists.

First, it appears that _TgtImpl attempts to add 'const' to the return type of
the overridden function:

../include/c++/10.0.1/experimental/executor:1170:2: error:
      return type of virtual function 'target' is not covariant with the return
type of the function it overrides (class type
      'const void *' is more qualified than class type 'void *'
        target(const std::type_info& __ti) const
        ^
../include/c++/10.0.1/experimental/executor:1138:21: note:
      overridden virtual function is here
      virtual void* target(const std::type_info&) const = 0;




The second issue is that socket_errc doesn't pass is_error_code_enum in
__basic_socket_impl:

../include/c++/10.0.1/experimental/socket:571:9: error:
      no viable overloaded '='
          __ec = socket_errc::already_open;
          ~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
../include/c++/10.0.1/system_error:208:7: note:
      candidate template ignored: requirement
'is_error_code_enum<std::experimental::net::v1::socket_errc>::value' was not
      satisfied [with _ErrorCodeEnum = std::experimental::net::v1::socket_errc]
      operator=(_ErrorCodeEnum __e) noexcept
      ^

(it then goes on to show a bunch of other options).

However, I believe this is because Clang is instantiating this check right
away, but the explicit specialization for socket_errc is after it:
https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/experimental/socket#L2605


In fact, clang diagnoses this as well:

../include/c++/10.0.1/experimental/socket:2606:12: error:
      explicit specialization of
'std::is_error_code_enum<std::experimental::net::v1::socket_errc>' after
instantiation
    struct is_error_code_enum<experimental::net::v1::socket_errc>
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/c++/10.0.1/system_error:206:26: note:
      implicit instantiation first required here
      typename enable_if<is_error_code_enum<_ErrorCodeEnum>::value,
                         ^

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

* [Bug libstdc++/94203] experimental/executor and socket header issues-
  2020-03-17 16:16 [Bug libstdc++/94203] New: experimental/executor and socket header issues- erich.keane at intel dot com
@ 2020-03-17 16:53 ` redi at gcc dot gnu.org
  2020-03-18  0:23 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2020-03-17 16:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94203

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
   Last reconfirmed|                            |2020-03-17
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
            Version|unknown                     |9.3.0
             Status|UNCONFIRMED                 |ASSIGNED
   Target Milestone|---                         |9.4
     Ever confirmed|0                           |1

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

* [Bug libstdc++/94203] experimental/executor and socket header issues-
  2020-03-17 16:16 [Bug libstdc++/94203] New: experimental/executor and socket header issues- erich.keane at intel dot com
  2020-03-17 16:53 ` [Bug libstdc++/94203] " redi at gcc dot gnu.org
@ 2020-03-18  0:23 ` cvs-commit at gcc dot gnu.org
  2020-04-24 13:07 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-18  0:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94203

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:98f29f5638f73d8e55590eba8098a537ba746287

commit r10-7233-g98f29f5638f73d8e55590eba8098a537ba746287
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Mar 18 00:23:39 2020 +0000

    libstdc++: Fix type-erasure in experimental::net::executor (PR 94203)

    The _Tgt and _TgtImpl types that implement type-erasure didn't agree on
    the virtual interface, so failed as soon as they were instantiated. With
    Clang they failed even sooner. The interface was also dependent on
    whether RTTI was enabled or not.

    This patch fixes the broken virtual functions and makes the type work
    without RTTI, by using a pointer to a specialization of a function
    template (similar to the approaches in std::function and std::any).

    The changes to the virtual functions would be an ABI change, except that
    the previous code didn't even compile if instantiated. This is
    experimental TS material anyway.

            PR libstdc++/94203
            * include/experimental/executor (executor::executor(Executor)):
Call
            make_shared directly instead of _M_create. Create _Tgt1 object.
            (executor::executor(allocator_arg_t, const ProtoAlloc&, Executor)):
            Call allocate_shared directly instead of _M_create. Create _Tgt2
            object.
            (executor::target_type): Add cast needed for new _Tgt interface.
            (executor::target): Define when RTTI is disabled. Use
_Tgt::_M_func.
            (executor::_Tgt): Define the same interface whether RTTI is enabled
or
            not.
            (executor::_Tgt::target_type, executor::_Tgt::target): Do not use
            std::type_info in the interface.
            (executor::_Tgt::_M_func): Add data member.
            (executor::_TgtImpl): Replace with _Tgt1 and _Tgt2 class templates.
            (executor::_Tgt1::_S_func): Define function to access target
without
            depending on RTTI.
            (executor::_M_create): Remove.
            (operator==, operator!=): Simplify comparisons for executor.
            * include/experimental/socket (is_error_code_enum<socket_errc>):
            Define specialization before use.
            * testsuite/experimental/net/executor/1.cc: New test.

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

* [Bug libstdc++/94203] experimental/executor and socket header issues-
  2020-03-17 16:16 [Bug libstdc++/94203] New: experimental/executor and socket header issues- erich.keane at intel dot com
  2020-03-17 16:53 ` [Bug libstdc++/94203] " redi at gcc dot gnu.org
  2020-03-18  0:23 ` cvs-commit at gcc dot gnu.org
@ 2020-04-24 13:07 ` redi at gcc dot gnu.org
  2020-04-24 13:32 ` cvs-commit at gcc dot gnu.org
  2020-04-24 13:32 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2020-04-24 13:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94203

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 94744 has been marked as a duplicate of this bug. ***

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

* [Bug libstdc++/94203] experimental/executor and socket header issues-
  2020-03-17 16:16 [Bug libstdc++/94203] New: experimental/executor and socket header issues- erich.keane at intel dot com
                   ` (2 preceding siblings ...)
  2020-04-24 13:07 ` redi at gcc dot gnu.org
@ 2020-04-24 13:32 ` cvs-commit at gcc dot gnu.org
  2020-04-24 13:32 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-24 13:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94203

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:942b32e261c414a033766ed7848d923f9630b991

commit r9-8543-g942b32e261c414a033766ed7848d923f9630b991
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Apr 24 14:29:37 2020 +0100

    libstdc++: Fix type-erasure in experimental::net::executor (PR 94203)

    The _Tgt and _TgtImpl types that implement type-erasure didn't agree on
    the virtual interface, so failed as soon as they were instantiated. With
    Clang they failed even sooner. The interface was also dependent on
    whether RTTI was enabled or not.

    This patch fixes the broken virtual functions and makes the type work
    without RTTI, by using a pointer to a specialization of a function
    template (similar to the approaches in std::function and std::any).

    The changes to the virtual functions would be an ABI change, except that
    the previous code didn't even compile if instantiated. This is
    experimental TS material anyway.

    Backport from mainline
    2020-03-18  Jonathan Wakely  <jwakely@redhat.com>

            PR libstdc++/94203
            * include/experimental/executor (executor::executor(Executor)):
Call
            make_shared directly instead of _M_create. Create _Tgt1 object.
            (executor::executor(allocator_arg_t, const ProtoAlloc&, Executor)):
            Call allocate_shared directly instead of _M_create. Create _Tgt2
            object.
            (executor::target_type): Add cast needed for new _Tgt interface.
            (executor::target): Define when RTTI is disabled. Use
_Tgt::_M_func.
            (executor::_Tgt): Define the same interface whether RTTI is enabled
or
            not.
            (executor::_Tgt::target_type, executor::_Tgt::target): Do not use
            std::type_info in the interface.
            (executor::_Tgt::_M_func): Add data member.
            (executor::_TgtImpl): Replace with _Tgt1 and _Tgt2 class templates.
            (executor::_Tgt1::_S_func): Define function to access target
without
            depending on RTTI.
            (executor::_M_create): Remove.
            (operator==, operator!=): Simplify comparisons for executor.
            * include/experimental/socket (is_error_code_enum<socket_errc>):
            Define specialization before use.
            * testsuite/experimental/net/executor/1.cc: New test.

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

* [Bug libstdc++/94203] experimental/executor and socket header issues-
  2020-03-17 16:16 [Bug libstdc++/94203] New: experimental/executor and socket header issues- erich.keane at intel dot com
                   ` (3 preceding siblings ...)
  2020-04-24 13:32 ` cvs-commit at gcc dot gnu.org
@ 2020-04-24 13:32 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2020-04-24 13:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94203

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 9.4

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

end of thread, other threads:[~2020-04-24 13:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-17 16:16 [Bug libstdc++/94203] New: experimental/executor and socket header issues- erich.keane at intel dot com
2020-03-17 16:53 ` [Bug libstdc++/94203] " redi at gcc dot gnu.org
2020-03-18  0:23 ` cvs-commit at gcc dot gnu.org
2020-04-24 13:07 ` redi at gcc dot gnu.org
2020-04-24 13:32 ` cvs-commit at gcc dot gnu.org
2020-04-24 13:32 ` redi at gcc dot gnu.org

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).