public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "milasudril at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/96064] New: Defaulted constexpr spaceship operator triggers internal compiler error after including utility
Date: Sun, 05 Jul 2020 08:06:30 +0000	[thread overview]
Message-ID: <bug-96064-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 96064
           Summary: Defaulted constexpr spaceship operator triggers
                    internal compiler error after including utility
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: milasudril at gmail dot com
  Target Milestone: ---

The following code crashes gcc-10.1

#include <utility>

class WrappedValue
{
    public:
        constexpr explicit WrappedValue(double val): m_value{val}{}

        constexpr bool operator<=>(WrappedValue const&) const = default

        constexpr double value() const
        {return m_value; }

    private:
        double m_value;
};

Any of the following actions prevents the crash:

 * Remove `#include <utility>`
 * Make `operator<=>` non-constexpr
 * Make `operator<=>` non-defaulted


Error log:

<source>: In member function 'constexpr bool WrappedValue::operator<=>(const
WrappedValue&) const':

<source>:8:24: internal compiler error: Segmentation fault

    8 |         constexpr bool operator<=>(WrappedValue const&) const =
default;

      |                        ^~~~~~~~

Please submit a full bug report,

with preprocessed source if appropriate.

See <https://gcc.gnu.org/bugs/> for instructions.

Compiler returned: 1


On compiler explorer: https://gcc.godbolt.org/z/mo7HkG

             reply	other threads:[~2020-07-05  8:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-05  8:06 milasudril at gmail dot com [this message]
2020-07-08 22:04 ` [Bug c++/96064] " mpolacek at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-96064-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).