public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gcc at zoecarver dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/101663] New: GCC crashes when assigning one single_view to another. Date: Wed, 28 Jul 2021 22:09:36 +0000 [thread overview] Message-ID: <bug-101663-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101663 Bug ID: 101663 Summary: GCC crashes when assigning one single_view to another. Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc at zoecarver dot com Target Milestone: --- GCC trunk seems to crash because of a constexpr issue when assigning two single views with non-assignable types. Here's a godbolt: https://tinyurl.com/2edutprj Here's a sample program: ``` #include <ranges> #include <cassert> struct NotAssignable { NotAssignable() = default; NotAssignable(const NotAssignable&) = default; NotAssignable(NotAssignable&&) = default; NotAssignable& operator=(const NotAssignable&) = delete; NotAssignable& operator=(NotAssignable&&) = delete; }; constexpr bool test() { const std::ranges::single_view<NotAssignable> a; std::ranges::single_view<NotAssignable> b; b = a; b = std::move(a); return true; } int main(int, char**) { test(); static_assert(test()); return 0; } ``` I suspect this is because of optional/copyable box weirdness during constexpr evaluation. I noticed this bug when implementing single_view for libc++. The interesting part is that this happens with both libstdc++ and libc++. That might help narrow down the reproducer.
next reply other threads:[~2021-07-28 22:09 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-28 22:09 gcc at zoecarver dot com [this message] 2021-08-03 12:35 ` [Bug c++/101663] " marxin at gcc dot gnu.org 2021-08-03 14:29 ` [Bug c++/101663] [11/12 Regression] " ppalka at gcc dot gnu.org 2021-08-03 16:35 ` ppalka at gcc dot gnu.org 2021-08-12 1:01 ` cvs-commit at gcc dot gnu.org 2021-08-12 12:18 ` cvs-commit at gcc dot gnu.org 2021-08-12 12:20 ` ppalka 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-101663-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: linkBe 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).