From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 88A84385DC30; Fri, 13 Aug 2021 20:15:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 88A84385DC30 From: "reichelt at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: error-recovery, ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: reichelt at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2021 20:15:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101903 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: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D template struct A { int i{}; A(); constexpr A(int) : A() {} }; constexpr A<0> a{0}; =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D bug.cc:9:19: error: 'constexpr A< >::A(int) [with int =3D 0]' called in a constant expression 9 | constexpr A<0> a{0}; | ^ bug.cc:6:13: note: 'constexpr A< >::A(int) [with int = =3D 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**, 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.]=