public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101663] New: GCC crashes when assigning one single_view to another.
@ 2021-07-28 22:09 gcc at zoecarver dot com
  2021-08-03 12:35 ` [Bug c++/101663] " marxin at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gcc at zoecarver dot com @ 2021-07-28 22:09 UTC (permalink / raw)
  To: gcc-bugs

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.

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

end of thread, other threads:[~2021-08-12 12:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28 22:09 [Bug c++/101663] New: GCC crashes when assigning one single_view to another gcc at zoecarver dot com
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

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