[Bug debug/115080] New: ICE when generating debug information for lambda in requires expression

cmingyi01 at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue May 14 02:25:28 GMT 2024


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

            Bug ID: 115080
           Summary: ICE when generating debug information for lambda in
                    requires expression
           Product: gcc
           Version: 14.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cmingyi01 at gmail dot com
  Target Milestone: ---

The following C++20 code triggers an ICE on gcc-12 onwards, including trunk.

struct Foo {
    template <class T>
    requires requires { [] {}; }
    struct Bar {
        T data;
    };
    Bar<int> b;
};
int main() {}


(See Compiler Explorer: https://godbolt.org/z/E911brobo)

Required command line flags: -std=c++20 -g

Compiler output:
<source>: In substitution of 'template<class T>  requires requires{<lambda>;}
struct Foo::Bar [with T = int]':
<source>:7:12:   required from here
    7 |     Bar<int> b;
      |            ^
<source>:3:25: internal compiler error: in gen_type_die_with_usage, at
dwarf2out.cc:26507
    3 |     requires requires { [] {}; }
      |                         ^~~~~
0x202ef4c internal_error(char const*, ...)
        ???:0
0x778915 fancy_abort(char const*, int, char const*)
        ???:0
0xe3581e rest_of_type_compilation(tree_node*, int)
        ???:0
0x7b9d56 finish_struct_1(tree_node*)
        ???:0
0x7bb0b4 finish_struct(tree_node*, tree_node*)
        ???:0
0x943ec2 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7dc716 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7dde08 constraints_satisfied_p(tree_node*, tree_node*)
        ???:0
0x937c61 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ???:0
0x95f671 finish_template_type(tree_node*, tree_node*, int)
        ???:0
0x90e414 c_parse_file()
        ???:0
0xa0c4d9 c_common_parse_file()
        ???:0
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.
Compiler returned: 1


More information about the Gcc-bugs mailing list