From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9C95F385DC06; Wed, 15 Apr 2020 06:15:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9C95F385DC06 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1586931334; bh=KeetIOpE8vAFaBtlXeMiVEJaj08gmaU7S9opY2HqISs=; h=From:To:Subject:Date:From; b=m1m28B/xQAN9pzbUnjAczhSpMsZKrtjLrhzY8af86/zMXboYpftgPJJuCIKxQVOaQ sxe3pWxUwMzuSpTyJ8UX4Tjo8UyAgqXbLOWgGqr0pZyMReb9baD+oIuCYndhkKtq+9 azUbuASsXTzcnPsOfUnH5lErYQCnPYDqYtM3S/N4= From: "frankhb1989 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94602] New: wrong semantic check to prvalue as decltype operand Date: Wed, 15 Apr 2020 06:15:34 +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: 9.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: frankhb1989 at gmail dot com 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: Wed, 15 Apr 2020 06:15:34 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94602 Bug ID: 94602 Summary: wrong semantic check to prvalue as decltype operand Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: frankhb1989 at gmail dot com Target Milestone: --- Case: struct S { ~S() =3D delete;=20=20=20=20 }; S f(); int main() { using X =3D decltype(f()); // #1 using Y =3D decltype(S{}); // #2 } #2 is wrongly rejected in C++17 mode. #1 is not ill-formed for the deleted destructor as per C++11 [dcl.type.simple]/5: > ... in the case where the operand of a decltype-specifier is a function call and the return type of the function is a class type, a special rule (5.2.2) ensures that the return type is not required to be complete (as it would be if the call appeared in a sub-expression or outsid= e of a decltype-specifier) ... In particular, it is not necessary to allocate stor= age for a temporary object or to enforce the semantic constraints associated wi= th invoking the type's destructor. ... This rule is expanded by P0135R1 for cases like #2, which is adopted in C++= 17. (See also P0929R2.)=