From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B0DCE3858C60; Wed, 2 Nov 2022 20:36:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B0DCE3858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667421384; bh=RmGT7BxODGPlaw+Ks92kg5fN1OburbEF29+S5B6mmLI=; h=From:To:Subject:Date:From; b=kmtg9q8D+6KC4jURzy1hESMiIDy5AyPdrmTvzUpCSd2QrR5o5KbCz1MDbn8nkBFqE z45F9PhPKwjJ16q+5RxV1gDCgQ9PI0B1gEgHOrstPo4zPvE7QzvDo/rOmWvEL5raD1 0ZYlHIg9ls6Y8hqCRUgG5AOqh93L1Ea+997ZFhjI= From: "kacper.slominski72 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107512] New: Defaulted virtual destructor not considered in constexpr context Date: Wed, 02 Nov 2022 20:36:24 +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: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kacper.slominski72 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107512 Bug ID: 107512 Summary: Defaulted virtual destructor not considered in constexpr context Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: kacper.slominski72 at gmail dot com Target Milestone: --- The following code causes a compiler error on GCC 12.2 and godbolt's trunk (compiled with "-std=3Dc++20 -Wall -Wextra -Wpedantic"): struct base { constexpr virtual ~base() =3D default; }; struct derived final : base { constexpr virtual ~derived() =3D default; }; constexpr derived der; The reported error is: :9:19: error: 'virtual constexpr derived::~derived()' used before i= ts definition 9 | constexpr derived der; | ^~~ Changing the destructor to the following makes the error go away: constexpr virtual ~derived() { } As does making the variable not constexpr. Clang seems to accept this witho= ut any problems.=