public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103048] New: Mandatory copy elision used for catch-by-value
@ 2021-11-02 15:34 songyuanyao at qq dot com
  2021-11-02 15:37 ` [Bug c++/103048] " songyuanyao at qq dot com
  2021-11-02 23:08 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: songyuanyao at qq dot com @ 2021-11-02 15:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103048
           Summary: Mandatory copy elision used for catch-by-value
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: songyuanyao at qq dot com
  Target Milestone: ---

struct B {
    B() = default;
    B(const B&) = delete;
};

int main() {
    try {
        throw B{};
    }
    catch (B) {}
}

This code shouldn't compile according to [except.throw]/5:
---
When the thrown object is a class object, the constructor selected for the
copy-initialization as well as the constructor selected for a
copy-initialization considering the thrown object as an lvalue shall be
non-deleted and accessible, even if the copy/move operation is elided
([class.copy.elision]).

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

* [Bug c++/103048] Mandatory copy elision used for catch-by-value
  2021-11-02 15:34 [Bug c++/103048] New: Mandatory copy elision used for catch-by-value songyuanyao at qq dot com
@ 2021-11-02 15:37 ` songyuanyao at qq dot com
  2021-11-02 23:08 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: songyuanyao at qq dot com @ 2021-11-02 15:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from songyuanyao <songyuanyao at qq dot com> ---
https://timsong-cpp.github.io/cppwp/except#throw-5

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

* [Bug c++/103048] Mandatory copy elision used for catch-by-value
  2021-11-02 15:34 [Bug c++/103048] New: Mandatory copy elision used for catch-by-value songyuanyao at qq dot com
  2021-11-02 15:37 ` [Bug c++/103048] " songyuanyao at qq dot com
@ 2021-11-02 23:08 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-02 23:08 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-11-02
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

end of thread, other threads:[~2021-11-02 23:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 15:34 [Bug c++/103048] New: Mandatory copy elision used for catch-by-value songyuanyao at qq dot com
2021-11-02 15:37 ` [Bug c++/103048] " songyuanyao at qq dot com
2021-11-02 23:08 ` pinskia 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).