public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-109876-4-3Gglp2q5u0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109876-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109876

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:b5138df96a93d3b5070c88b8617eabd38cb24ab6

commit r14-2527-gb5138df96a93d3b5070c88b8617eabd38cb24ab6
Author: Marek Polacek <polacek@redhat.com>
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 == 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 <jason@redhat.com>

            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) <case VAR_DECL>: 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.

  parent reply	other threads:[~2023-07-14 17:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-16 18:33 [Bug c++/109876] New: " barry.revzin at gmail dot com
2023-05-16 18:40 ` [Bug c++/109876] [10/11/12/13/14 Regression] " mpolacek at gcc dot gnu.org
2023-05-16 18:43 ` pinskia at gcc dot gnu.org
2023-05-16 18:45 ` mpolacek at gcc dot gnu.org
2023-05-16 18:46 ` pinskia at gcc dot gnu.org
2023-05-16 19:13 ` mpolacek at gcc dot gnu.org
2023-05-18 16:41 ` mpolacek at gcc dot gnu.org
2023-05-18 17:07 ` ppalka at gcc dot gnu.org
2023-05-18 17:26 ` jason at gcc dot gnu.org
2023-05-19 21:01 ` mpolacek at gcc dot gnu.org
2023-05-24 20:20 ` mpolacek at gcc dot gnu.org
2023-05-24 20:28 ` jason at gcc dot gnu.org
2023-05-26 17:02 ` mpolacek at gcc dot gnu.org
2023-05-26 18:08 ` mpolacek at gcc dot gnu.org
2023-07-07 10:45 ` [Bug c++/109876] [11/12/13/14 " rguenth at gcc dot gnu.org
2023-07-14 17:16 ` cvs-commit at gcc dot gnu.org [this message]
2023-07-14 17:18 ` [Bug c++/109876] [11/12/13 " mpolacek at gcc dot gnu.org
2023-07-19 11:26 ` rguenth at gcc dot gnu.org
2023-12-12  0:37 ` cvs-commit at gcc dot gnu.org
2023-12-12  0:39 ` [Bug c++/109876] [11/12 " mpolacek at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109876-4-3Gglp2q5u0@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).