From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C15443858410; Fri, 14 Jul 2023 17:16:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C15443858410 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689354997; bh=pm6G5uB8LgnCEnbKS/SQO7M0fLFoDvvtBspF4UouaJI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=all0MWZaEXYddm3ZFmgCLPs6Nxdqa6jRlcMNnQJKX11dQgJBtJd4yR6pr8gvn6Q1F 3/nruotBAYG8aaiYcj6DDfhA3qBPEpRuC0vcuimxI0fAE7GB2u1rEsxCGLJNq6tPPJ 3NDi2lLl3wtNXZOtGSrMUaW5+jTAvJZrZQGaTRoc= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109876] [11/12/13/14 Regression] initializer_list not usable in constant expressions in a template Date: Fri, 14 Jul 2023 17:16:36 +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.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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=3D109876 --- Comment #13 from CVS Commits --- The trunk branch has been updated by Marek Polacek : https://gcc.gnu.org/g:b5138df96a93d3b5070c88b8617eabd38cb24ab6 commit r14-2527-gb5138df96a93d3b5070c88b8617eabd38cb24ab6 Author: Marek Polacek Date: Thu May 25 18:54:18 2023 -0400 c++: wrong error with static constexpr var in tmpl [PR109876] Since r8-509, we'll no longer create a static temporary var for the initializer '{ 1, 2 }' for num in the attached test because the code in finish_compound_literal is now guarded by '&& fcl_context =3D=3D fcl_c99' but it's fcl_functional here. This causes us to reject num as non-constant when evaluating it in a template. Jason's idea was to treat num as value-dependent even though it actually isn't. This patch implements that suggestion. We weren't marking objects whose type is an empty class type constant. This patch changes that so that v_d_e_p doesn't need to check is_really_empty_class. Co-authored-by: Jason Merrill PR c++/109876 gcc/cp/ChangeLog: * decl.cc (cp_finish_decl): Set TREE_CONSTANT when initializing an object of empty class type. * pt.cc (value_dependent_expression_p) : Treat a constexpr-declared non-constant variable as value-dependent. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/constexpr-template12.C: New test. * g++.dg/cpp1z/constexpr-template1.C: New test. * g++.dg/cpp1z/constexpr-template2.C: New test.=