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

            Bug ID: 125633
           Summary: ICE when parsing multiple postconditions that mutate
                    the result object in a C++26 member function
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: s.kimura.h41104 at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/ds43vE4sE

Reproducer:
```
struct S {
  int foo() post(r : const_cast<int &>(r)++) post(r : const_cast<int &>(r)++) {
    return 1;
  };
};
```

Backtrace:
<source>: In member function 'int S::foo()':
<source>:2:42: internal compiler error: in tsubst_expr, at cp/pt.cc:23226
    2 |   int foo() post(r : const_cast<int &>(r)++) post(r : const_cast<int
&>(r)++) {
      |                                          ^~
0x29f4b18 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x29e975b internal_error(char const*, ...)
        ???:0
0xb33da0 fancy_abort(char const*, int, char const*)
        ???:0
0xd33acd cp_parser_late_contract_condition(cp_parser*, tree_node*, tree_node*)
        ???:0
0xd877d3 c_parse_file()
        ???:0
0xf17359 c_common_parse_file()
        ???:0

This goes back to gcc-16:
https://godbolt.org/z/KsWrc9TG3

Reply via email to