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++/94592] [10 Regression] ICE in non-type template parameter with constexpr constructor Date: Mon, 20 Apr 2020 23:55:00 +0000 [thread overview] Message-ID: <bug-94592-4-cGkOK8AwZA@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-94592-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94592 --- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>: https://gcc.gnu.org/g:d419e176d74162af6513be0b3bc1031726543993 commit r10-7836-gd419e176d74162af6513be0b3bc1031726543993 Author: Marek Polacek <polacek@redhat.com> Date: Fri Apr 17 15:47:15 2020 -0400 c++: Fix ICE with { } as template argument [PR94592] As an extension (there should be a CWG about this though), we support braced-init-list as a template argument, but convert_nontype_argument had trouble digesting them. We ICEd because of the double coercion we perform for template arguments: convert_nontype_argument called from finish_template_type got a { }, and since a class type was involved and we were in a template, convert_like created an IMPLICIT_CONV_EXPR. Then the second conversion of the same argument crashed in constexpr.c because the IMPLICIT_CONV_EXPR had gotten wrapped in a TARGET_EXPR. Another issue was that an IMPLICIT_CONV_EXPR leaked to constexpr.c when building an aggregate init. We should have instantiated the IMPLICIT_CONV_EXPR in the first call to convert_nontype_argument, but we didn't, because the call to is_nondependent_constant_expression returned false because it checks !BRACE_ENCLOSED_INITIALIZER_P. Then non_dep was false even though the expression didn't contain anything dependent and we didn't instantiate it in convert_nontype_argument. To fix this, check BRACE_ENCLOSED_INITIALIZER_P in cxx_eval_outermost_constant_expr rather than in is_nondependent_*. PR c++/94592 * constexpr.c (cxx_eval_outermost_constant_expr): Return when T is a BRACE_ENCLOSED_INITIALIZER_P. (is_nondependent_constant_expression): Don't check BRACE_ENCLOSED_INITIALIZER_P. (is_nondependent_static_init_expression): Likewise. * g++.dg/cpp2a/nontype-class34.C: New test. * g++.dg/cpp2a/nontype-class35.C: New test.
next prev parent reply other threads:[~2020-04-20 23:55 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-14 10:44 [Bug c++/94592] New: " pacoarjonilla at yahoo dot es 2020-04-14 10:49 ` [Bug c++/94592] " rguenth at gcc dot gnu.org 2020-04-14 11:16 ` marxin at gcc dot gnu.org 2020-04-14 11:41 ` pacoarjonilla at yahoo dot es 2020-04-14 14:32 ` mpolacek at gcc dot gnu.org 2020-04-14 16:29 ` mpolacek at gcc dot gnu.org 2020-04-14 16:38 ` pacoarjonilla at yahoo dot es 2020-04-15 17:57 ` [Bug c++/94592] [10 Regression] " mpolacek at gcc dot gnu.org 2020-04-18 3:43 ` mpolacek at gcc dot gnu.org 2020-04-20 13:57 ` rguenth at gcc dot gnu.org 2020-04-20 23:55 ` cvs-commit at gcc dot gnu.org [this message] 2020-04-20 23:55 ` 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-94592-4-cGkOK8AwZA@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: linkBe 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).