public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "reichelt at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/101903] New: [9/10/11/12 Regression] ICE with invalid constexpr constructor in template class
Date: Fri, 13 Aug 2021 20:15:56 +0000	[thread overview]
Message-ID: <bug-101903-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 101903
           Summary: [9/10/11/12 Regression] ICE with invalid constexpr
                    constructor in template class
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following invalid code snippet triggers an ICE since GCC 7.1.0:

===============================
template<int> struct A
{
  int i{};

  A();
  constexpr A(int) : A() {}
};

constexpr A<0> a{0};
===============================

bug.cc:9:19: error: 'constexpr A<<anonymous> >::A(int) [with int <anonymous> =
0]' called in a constant expression
    9 | constexpr A<0> a{0};
      |                   ^
bug.cc:6:13: note: 'constexpr A<<anonymous> >::A(int) [with int <anonymous> =
0]' is not usable as a 'constexpr' function because:
    6 |   constexpr A(int) : A() {}
      |             ^
bug.cc:6:13: internal compiler error: in build_data_member_initialization, at
cp/constexpr.c:400
0x66cf30 build_data_member_initialization
        ../../gcc/gcc/cp/constexpr.c:400
0x960432 build_constexpr_constructor_member_initializers
        ../../gcc/gcc/cp/constexpr.c:612
0x960432 massage_constexpr_body
        ../../gcc/gcc/cp/constexpr.c:738
0x96ce3d explain_invalid_constexpr_fn(tree_node*)
        ../../gcc/gcc/cp/constexpr.c:982
0x9621e1 cxx_eval_call_expression
        ../../gcc/gcc/cp/constexpr.c:2594
0x96543c cxx_eval_constant_expression
        ../../gcc/gcc/cp/constexpr.c:6269
0x968cc4 cxx_eval_outermost_constant_expr
        ../../gcc/gcc/cp/constexpr.c:7301
0x96da7e maybe_constant_init_1
        ../../gcc/gcc/cp/constexpr.c:7756
0xb9902a store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ../../gcc/gcc/cp/typeck2.c:777
0x9b4cc6 check_initializer
        ../../gcc/gcc/cp/decl.c:7185
0x9dab09 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/gcc/cp/decl.c:8119
0xac5174 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:22556
0xaa0773 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:15088
0xacfdb5 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:14787
0xad078e cp_parser_toplevel_declaration
        ../../gcc/gcc/cp/parser.c:14808
0xad078e cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4978
0xad078e c_parse_file()
        ../../gcc/gcc/cp/parser.c:46558
0xbf924d c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1223
Please submit a full bug report, [etc.]

             reply	other threads:[~2021-08-13 20:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13 20:15 reichelt at gcc dot gnu.org [this message]
2021-08-16  7:59 ` [Bug c++/101903] " marxin at gcc dot gnu.org
2021-08-16  9:00 ` rguenth at gcc dot gnu.org
2022-05-27  9:46 ` [Bug c++/101903] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:46 ` jakub at gcc dot gnu.org
2023-07-07 10:40 ` [Bug c++/101903] [11/12/13/14 " rguenth 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-101903-4@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).