From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DF3AD3847825; Tue, 29 Jun 2021 01:15:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF3AD3847825 From: "lewissbaker.opensource at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/101247] New: ICE when using static constexpr bool defined in base-class in derived class constructor requires-clause Date: Tue, 29 Jun 2021 01:15:14 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: lewissbaker.opensource at gmail dot com 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 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: Tue, 29 Jun 2021 01:15:15 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101247 Bug ID: 101247 Summary: ICE when using static constexpr bool defined in base-class in derived class constructor requires-clause Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lewissbaker.opensource at gmail dot com Target Milestone: --- Compiling the following code with GCC trunk and flags: -std=3Dc++20 ``` template struct in_place_type_t {}; template inline constexpr in_place_type_t in_place_type; template inline constexpr bool outer_helper_v =3D true; template struct foo { struct type; template static constexpr bool helper_v =3D outer_helper_v; }; template struct foo::type { template requires helper_v type(in_place_type_t) {} }; int main() { foo::type x(in_place_type); } ``` results in an internal compiler-error ``` : In substitution of 'template requires helper_v foo::type::type(in_place_type_t) [with U =3D {int}]': :26:40: required from here :21:18: internal compiler error: tree check: accessed elt 1 of 'tree_vec' with 0 elts in tsubst_pack_expansion, at cp/pt.c:13084 21 | requires helper_v | ^~~~~~~~~~~ 0x1d4c179 internal_error(char const*, ...) ???:0 0x685746 tree_vec_elt_check_failed(int, int, char const*, int, char const*) ???:0 0x99e0bc tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*) ???:0 0x9afa62 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) ???:0 0x9b064b tsubst_argument_pack(tree_node*, tree_node*, int, tree_node*) ???:0 0x9afa04 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) ???:0 0x983ebd tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0x7abcda constraints_satisfied_p(tree_node*, tree_node*) ???:0 0x9c26c3 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bo= ol, bool) ???:0 0x74abc9 build_new_method_call(tree_node*, tree_node*, vec**, tree_node*, int, tree_node**, int) ???:0 0x74c8c0 build_special_member_call(tree_node*, tree_node*, vec**, tree_node*, int, int) ???:0 0x8611c8 build_aggr_init(tree_node*, tree_node*, int, int) ???:0 0x81f0d9 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ???:0 0x94f36d c_parse_file() ???:0 0xad2922 c_common_parse_file() ???:0 ``` See https://godbolt.org/z/ebnxfsMs9 for an example.=