https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92838
Bug ID: 92838 Summary: ICE (internal compiler error) calling lambda object with requires clause (in in dependent_type_p) Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sw6ueyz at gmail dot com Target Milestone: --- Created attachment 47433 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47433&action=edit the source // this code generates ICE in g++ // // command line : // g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.71.0/gcc-head/include -std=gnu++2a // // test link : // https://godbolt.org/z/yeZ-Mc template< class _Type > auto foo( _Type&& ) { if ( []() requires ( sizeof( _Type ) == 4U ) { return true; }() ) return true; else return false; } int main() { foo( 0 ); return 0; } /* error log : prog.cc: In instantiation of 'foo(_Type&&) [with _Type = int]::<lambda()>': prog.cc:5:10: required from 'auto foo(_Type&&) [with _Type = int]' prog.cc:14:9: required from here prog.cc:5:26: internal compiler error: in dependent_type_p, at cp/pt.c:26007 5 | if ( []() requires ( sizeof( _Type ) == 4U ) { return true; }() ) | ^~~~~~~~~~~~~~~ 0x5a08f0 dependent_type_p(tree_node*) ../../source/gcc/cp/pt.c:26007 0x739417 cxx_sizeof_or_alignof_type(tree_node*, tree_code, bool, bool) ../../source/gcc/cp/typeck.c:1687 0x6f3098 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../source/gcc/cp/pt.c:19188 0x6f1114 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../source/gcc/cp/pt.c:18814 0x6ecf8d tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../source/gcc/cp/pt.c:18814 0x6ecf8d tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../source/gcc/cp/pt.c:18472 0x61bef2 satisfy_constraint_r ../../source/gcc/cp/constraint.cc:2500 0x61c668 satisfy_constraint ../../source/gcc/cp/constraint.cc:2576 0x61d8e4 satisfy_declaration_constraints ../../source/gcc/cp/constraint.cc:2594 0x61dbd8 constraint_satisfaction_value ../../source/gcc/cp/constraint.cc:2709 0x61dbd8 constraints_satisfied_p(tree_node*) ../../source/gcc/cp/constraint.cc:2730 0x671cb4 maybe_add_lambda_conv_op(tree_node*) ../../source/gcc/cp/lambda.c:1052 0x6f0d5f tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*) ../../source/gcc/cp/pt.c:18784 0x6f35d4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../source/gcc/cp/pt.c:20154 0x6f228f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../source/gcc/cp/pt.c:19404 0x6f228f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../source/gcc/cp/pt.c:19404 0x6ecf8d tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../source/gcc/cp/pt.c:18814 0x6ecf8d tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../source/gcc/cp/pt.c:18472 0x6ee3b4 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../source/gcc/cp/pt.c:17558 0x6ee3b4 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../source/gcc/cp/pt.c:18454 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. */