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

            Bug ID: 122352
           Summary: ICE: in tsubst_expr, at cp/pt.cc:22419
           Product: gcc
           Version: 15.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qingren2hxb at gmail dot com
  Target Milestone: ---

Created attachment 62589
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62589&action=edit
bug report by using -freport-bug

========================================
$g++ -v
Using built-in specs.
COLLECT_GCC=/workspace/installation/bin/g++
COLLECT_LTO_WRAPPER=/workspace/installation/libexec/gcc/x86_64-pc-linux-gnu/15.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /workspace/gcc/configure --prefix=/workspace/installation
--enable-coverage --enable-checking --disable-multilib --disable-shared
--disable-bootstrap --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.1.0 (GCC)
========================================
// test.C
#include <type_traits>

struct S {
    int f(int i) { return i; }
};

template<typename T>
concept C2 = not requires(T o, int i) {
    { o.f(i+1) };
};

int main() {
    static_assert(requires(S s, int i)
        { 
            requires (not C2<S> && (requires(S so, int j)
                { 
                    [so](int k){return so.f(k); }(j);
                })
            );
        },
        "Outer check");
   return 0;
}
========================================
$ g++ -std=c++20 test.C
test.C: In function 'int main()':
test.C:17:21: internal compiler error: in tsubst_expr, at cp/pt.cc:22419
   17 |                     [so](int k){return so.f(k); }(j);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x5d4e2e6 internal_error(char const*, ...)
        /workspace/gcc/gcc/diagnostic-global-context.cc:517
0x5cf3c1f fancy_abort(char const*, int, char const*)
        /workspace/gcc/gcc/diagnostic.cc:1749
0x156cbd2 tsubst_expr(tree_node*, tree_node*, int, tree_node*)
        /workspace/gcc/gcc/cp/pt.cc:22419
0x14ddcf6 instantiate_non_dependent_expr_internal(tree_node*, int)
        /workspace/gcc/gcc/cp/pt.cc:6531
0xfdfbf6 fold_non_dependent_expr_template
        /workspace/gcc/gcc/cp/constexpr.cc:9592
0xfe03f7 fold_non_dependent_init(tree_node*, int, bool, tree_node*)
        /workspace/gcc/gcc/cp/constexpr.cc:9690
0x1724b15 massage_init_elt
        /workspace/gcc/gcc/cp/typeck2.cc:1580
0x17268a5 process_init_constructor_record
        /workspace/gcc/gcc/cp/typeck2.cc:1816
0x1728c3e process_init_constructor
        /workspace/gcc/gcc/cp/typeck2.cc:2111
0x1723b69 digest_init_r
        /workspace/gcc/gcc/cp/typeck2.cc:1406
0x1723f74 digest_init_flags(tree_node*, tree_node*, int, int)
        /workspace/gcc/gcc/cp/typeck2.cc:1452
0x160716a finish_compound_literal(tree_node*, tree_node*, int, fcl_t)
        /workspace/gcc/gcc/cp/semantics.cc:3903
0x1206cb0 build_lambda_object(tree_node*)
        /workspace/gcc/gcc/cp/lambda.cc:125
0x13c2257 cp_parser_lambda_expression
        /workspace/gcc/gcc/cp/parser.cc:11855
0x13a8c23 cp_parser_primary_expression
        /workspace/gcc/gcc/cp/parser.cc:6229
0x13b22c6 cp_parser_postfix_expression
        /workspace/gcc/gcc/cp/parser.cc:8238
0x13ba190 cp_parser_unary_expression
        /workspace/gcc/gcc/cp/parser.cc:9733
0x13bcc8d cp_parser_cast_expression
        /workspace/gcc/gcc/cp/parser.cc:10648
0x13bce20 cp_parser_binary_expression
        /workspace/gcc/gcc/cp/parser.cc:10751
0x13bece9 cp_parser_assignment_expression
        /workspace/gcc/gcc/cp/parser.cc:11096
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to