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

            Bug ID: 123669
           Summary: [14/15/16 Regression] ICE in write_expression
                    (mangle.cc) with requires expression in lambda
                    trailing return type
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jirehguo at tju dot edu.cn
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/6sEfM5b14
The following c++ code crash gcc trunk with -std=c++23 flag.
Goes back to 14.1 with checking.
Clang accepts it.


Code:
```cpp
#include <functional>
template <typename T> void unresolved_func(T t);
int main() {
  auto lambda =
      []<typename T>(T t) -> std::enable_if_t < requires(T t) {
    unresolved_func(t);
  }
  > {};
  lambda(42);
}
```

Stack dump:
```
<source>:5:7: internal compiler error: in write_expression, at
cp/mangle.cc:3498
    5 |       []<typename T>(T t) -> std::enable_if_t < requires(T t) {
      |       ^
0x2950a78 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x294583b internal_error(char const*, ...)
        ???:0
0xb1ec34 fancy_abort(char const*, int, char const*)
        ???:0
0xc80c89 mangle_decl(tree_node*)
        ???:0
0x18c3565 decl_assembler_name(tree_node*)
        ???:0
0x18ed048 assign_assembler_name_if_needed(tree_node*)
        ???:0
0xfc6a42 cgraph_node::analyze()
        ???:0
0xfca156 symbol_table::finalize_compilation_unit()
        ???: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
```

Reply via email to