public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/105926] New: Using a spaceship operator on an optional of a type derived from optional causes infinite constraint recursion
@ 2022-06-11 12:17 ville.voutilainen at gmail dot com
  2022-06-11 12:18 ` [Bug libstdc++/105926] " ville.voutilainen at gmail dot com
  0 siblings, 1 reply; 2+ messages in thread
From: ville.voutilainen at gmail dot com @ 2022-06-11 12:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105926
           Summary: Using a spaceship operator on an optional of a type
                    derived from optional causes infinite constraint
                    recursion
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ville.voutilainen at gmail dot com
  Target Milestone: ---

Testcase:

#include <optional>

struct oink : std::optional<int> {
};

bool operator<(const oink&, const oink) {return false;}
bool operator>(const oink&, const oink) {return true;}
bool operator<=(const oink&, const oink) {return false;}
bool operator>=(const oink&, const oink) {return true;}
bool operator==(const oink&, const oink) {return false;}
bool operator!=(const oink&, const oink) {return true;}

int main()
{
    oink a;
    std::optional<oink> b;
    b <=> a;
}

Ends up, eventually, with..

error: satisfaction of atomic constraint 'requires(const typename
std::remove_reference<_Tp>::type& __t, const typename
std::remove_reference<_Arg>::type& __u) {{__t < __u} -> decltype(auto)
[requires std::__detail::__boolean_testable<<placeholder>, >];{__t > __u} ->
decltype(auto) [requires std::__detail::__boolean_testable<<placeholder>,
>];{__t <= __u} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];{__t >= __u} ->
decltype(auto) [requires std::__detail::__boolean_testable<<placeholder>,
>];{__u < __t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];{__u > __t} ->
decltype(auto) [requires std::__detail::__boolean_testable<<placeholder>,
>];{__u <= __t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];{__u >= __t} ->
decltype(auto) [requires std::__detail::__boolean_testable<<placeholder>, >];}
[with _Up = oink; _Tp = oink]' depends on itself
  302 |         = requires(const remove_reference_t<_Tp>& __t,
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  303 |                    const remove_reference_t<_Up>& __u) {
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  304 |           { __t <  __u } -> __boolean_testable;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  305 |           { __t >  __u } -> __boolean_testable;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  306 |           { __t <= __u } -> __boolean_testable;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  307 |           { __t >= __u } -> __boolean_testable;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  308 |           { __u <  __t } -> __boolean_testable;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  309 |           { __u >  __t } -> __boolean_testable;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  310 |           { __u <= __t } -> __boolean_testable;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  311 |           { __u >= __t } -> __boolean_testable;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  312 |         };

The relevant bit being "satisfaction of atomic constraint foo depends on
itself".

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

* [Bug libstdc++/105926] Using a spaceship operator on an optional of a type derived from optional causes infinite constraint recursion
  2022-06-11 12:17 [Bug libstdc++/105926] New: Using a spaceship operator on an optional of a type derived from optional causes infinite constraint recursion ville.voutilainen at gmail dot com
@ 2022-06-11 12:18 ` ville.voutilainen at gmail dot com
  0 siblings, 0 replies; 2+ messages in thread
From: ville.voutilainen at gmail dot com @ 2022-06-11 12:18 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |ville.voutilainen at gmail dot com

--- Comment #1 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
I have a patch for it, and this likely needs a LWG issue and probably a LEWG
ack. I'll submit the latter soon-ish, and will post the patch for review, too.

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

end of thread, other threads:[~2022-06-11 12:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-11 12:17 [Bug libstdc++/105926] New: Using a spaceship operator on an optional of a type derived from optional causes infinite constraint recursion ville.voutilainen at gmail dot com
2022-06-11 12:18 ` [Bug libstdc++/105926] " ville.voutilainen at gmail dot com

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