From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1541A3855161; Wed, 30 Nov 2022 19:35:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1541A3855161 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669836957; bh=C/F6fH6F6A/BMwuZHEsty5WKKlvoAIAdRzGe7VJadA0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PbUckqUurlCJ1T9s/auVP32yS2pRXX6cLvYo6dSGq0WIBFLwcGNk5mRDA9lsoJQpY gXzfRgtoKVHLIEq36wJcAZCauK52/aywtnfodyJNG02WcZHOcjww7EMMiIsdmu0GjD NkJwPg9lbmkh0sAwes0Sw3Y6DtwLNA3IWtA2YmPw= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107939] [11/12/13 Regression] Rejects use of `extern const` variable in a template Date: Wed, 30 Nov 2022 19:35:56 +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: 13.0 X-Bugzilla-Keywords: needs-bisection, rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org 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: 11.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status keywords target_milestone short_desc cf_reconfirmed_on everconfirmed 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=3D107939 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Keywords| |needs-bisection Target Milestone|--- |11.4 Summary|Rejects use of `extern |[11/12/13 Regression] |const` variable in a |Rejects use of `extern |template |const` variable in a | |template Last reconfirmed| |2022-11-30 Ever confirmed|0 |1 --- Comment #1 from Andrew Pinski --- Replacing auto with int (and adding a message to static_assert), gets you a valid C++14 testcase: ``` struct Q { struct P { const Q* p; }; int n; constexpr P operator()(int) const { return {this}; } }; extern const Q q; #if 1 template constexpr auto p =3D q(0); static_assert(p<0>.p =3D=3D &q, ""); #else constexpr auto p =3D q(0); static_assert(p.p =3D=3D &q, ""); #endif constexpr Q q =3D {}; ``` This worked with GCC 10.4.0.=