From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7B2943858C50; Fri, 14 Oct 2022 18:18:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B2943858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665771516; bh=1vWkZLZDL5fWHdK+gUamEfOMQQa5Mey6B7Zp6E4O0Pg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Y1TImYLYxqc4kjFxzNizw/WAEJbDr0t6MAqYT/0AWh+aGAHJEOQ1kIeBUoKU8Mz4t elIxbNsEYU5K7NmOhOZOvwCrjJLKIvvgxFA/5fO4FPHjTdd9AwlEx4QkmKGHUkPM4v rUwwjAo+r3f9ttTHcQ3XEeWZWwJDYSlsqYVM1FYo= From: "chgros at coverity dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106812] Throwing a non-copyable exception Date: Fri, 14 Oct 2022 18:18:35 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: chgros at coverity dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106812 Charles-Henri Gros changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chgros at coverity dot com --- Comment #4 from Charles-Henri Gros --- It's worse than this, "throw" will even move a non-movable value in the abs= ence of a copy constructor: #include #include using namespace std; int main(int argc, char const * const *argv) { unique_ptr u(new int); cout << "u.get() first: " << (void*)u.get() << endl; try { throw u; } catch(...) { } cout << "u.get() after throw: " << (void*)u.get() << endl; }=