From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9564C3858299; Wed, 29 Nov 2023 19:25:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9564C3858299 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701285903; bh=7zVkbfnJxUBhHgSsV7U0Y1968yc1wmr7yDhuJY6fMRM=; h=From:To:Subject:Date:From; b=byDzUSKGx1dRrjOnvVd1NwxctQk4RFREZBk6jI3ghHcIZqTh98/TPC/tVzI7CV43W PKqH9ps9TWX07o5m6dJ0+1/KY4RWEXSeD/O/FAbaRzfcxIZh1U2rFwv1hYCLQEy4zr u1iI2LxsjBCYxamxv3ewoipVVbtFKsUpe12/TEnk= From: "janpmoeller at gmx dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/112769] New: ICE on valid code related to requires-expression Date: Wed, 29 Nov 2023 19:25:03 +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: 13.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: janpmoeller at gmx dot de 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112769 Bug ID: 112769 Summary: ICE on valid code related to requires-expression Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: janpmoeller at gmx dot de Target Milestone: --- All gcc versions since (and including) 11.2 reject the following valid C++20 code: ////////////////////////////////////////////////////////////// template struct type { constexpr explicit type(T value) { } template constexpr explicit type(type value) requires requires { T{value}; } { } }; template using alias =3D type<0, T>; constexpr alias foo{123}; ////////////////////////////////////////////////////////////// The reported error is: ############################################################## :11:18: internal compiler error: in add_outermost_template_args, at cp/pt.cc:617 11 | requires requires { T{value}; } | ^~~~~~~~~~~~~~~~~~~~~~ 0x1ce7bde internal_error(char const*, ...) ???:0 0x7290fc fancy_abort(char const*, int, char const*) ???:0 0x7879b6 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*) ???:0 0x783c90 tsubst_constraint(tree_node*, tree_node*, int, tree_node*) ???:0 0x783df1 tsubst_constraint_info(tree_node*, tree_node*, int, tree_node*) ???:0 0x8b1e90 do_auto_deduction(tree_node*, tree_node*, tree_node*, int, auto_deduction_context, tree_node*, int, tree_node*) ???:0 0x7ccd01 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ???:0 0x89fd5b c_parse_file() ???:0 0x98c5d9 c_common_parse_file() ???:0 Please submit a full bug report, with preprocessed source. Please include the complete backtrace with any bug report. See for instructions. Preprocessed source stored into /tmp/cclpGAjI.out file, please attach this = to your bugreport. Compiler returned: 1 ############################################################## gcc-11.1 accepts the code.Here is a link to compiler explorer with the same example: https://godbolt.org/z/aq1d53anv Note that the first (non-template) constructor is required to make the code valid, but it is not required to reproduce the issue. Removing it still lea= ds to the same ICE on gcc > 11.1, whereas gcc-11.1 (correctly) rejects it due = to failed argument deduction.=