From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 70AE1385C017; Fri, 20 Mar 2020 00:08:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 70AE1385C017 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1584662884; bh=w7SdnrEkpIFJnl5sjQogomgC205eA6OjPIItxcHPG4A=; h=From:To:Subject:Date:From; b=ECbg2uUaRCUVIF4W97Eu1BkTS5sPWsCnI3m0Be1tW1ZW47GdKBKigSoysbItgZCC5 peJoXkU8PlTQhsHCOLoGR82Zeecm+cNZvIsqCU5cCcX33v6lkcV4qP07G6TxLlEX+R CYdoCTcOhX8TY6rdEEaijBc79gW9z+rgYhIxCG1U= From: "herring at lanl dot gov" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94231] New: Invalid move constructor defaulted outside of class as deleted is accepted Date: Fri, 20 Mar 2020 00:08:04 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: herring at lanl dot gov X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Mar 2020 00:08:04 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94231 Bug ID: 94231 Summary: Invalid move constructor defaulted outside of class as deleted is accepted Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: herring at lanl dot gov Target Milestone: --- GCC incorrectly accepts the following: struct F {F(F&&)=3Ddelete;}; template struct M { F f; M(); M(const M&); M(M&&); }; template M::M(M&&)=3Ddefault; M<> f() { M<> m; return m; } The returned value is implicitly moved-from (although adding static_cast&&> makes no difference), which should discover that M's move constructor is invalid because it is defaulted after its first declaration and defined as deleted, but simply falls back to the copy constructor instead. If M is not a template, GCC correctly rejects, although the error messages = are a bit confused.=