Skip to content

ICE in lambda within contract assertion #6

@NinaRanns

Description

@NinaRanns
void f(int i) pre([i](){ return true;}()){};

causes

<source>: In lambda function:
<source>:1:23: internal compiler error: in build_capture_proxy, at cp/lambda.cc:470
    1 | void f(int i) pre([i](){ return true;}()){};
      |                       ^
0x26dfde5 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1], diagnostic_t)
	???:0
0x26ed992 internal_error(char const*, ...)
	???:0
0xa65c9e fancy_abort(char const*, int, char const*)
	???:0
0xb99357 start_lambda_function(tree_node*, tree_node*)
	???:0
0xc719ba c_parse_file()
	???:0
0xdc8489 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.
ASM generation compiler returned: 1

reproducible with both attribute and non attribute syntax. Not visible without the -fcontracts-nonatt flag

see
https://godbolt.org/z/ssjeYx4av

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions