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

            Bug ID: 119401
           Summary: [15 regression] ICE when lambda is used as template
                    argument in member function parameter type
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cmingyi01 at gmail dot com
  Target Milestone: ---

The following C++20 code causes an ICE in trunk.
```
template <auto>
struct B {};

template <class T>
struct A {
    static void f(B<[] {}>) {}
};

int main() {
    A<int>::f({});
}
```

Output:
```
<source>: In instantiation of 'static void A<T>::f(B<<lambda> >) [with T =
int]':
<source>:10:14:   required from here
   10 |     A<int>::f({});
      |     ~~~~~~~~~^~~~
<source>:6:19: internal compiler error: in convert_nontype_argument, at
cp/pt.cc:7977
    6 |     static void f(B<[] {}>) {}
      |                   ^~~~~~~~
0x291d555 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x2934526 internal_error(char const*, ...)
        ???:0
0xacfad8 fancy_abort(char const*, int, char const*)
        ???:0
0xd152c3 coerce_template_parms(tree_node*, tree_node*, tree_node*, int, bool)
        ???:0
0xd27a69 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int)
        ???:0
0xd28f42 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xd1c73d instantiate_decl(tree_node*, bool, bool)
        ???:0
0xd5688b instantiate_pending_templates(int)
        ???:0
0xbdcdd0 c_parse_final_cleanups()
        ???:0
0xe54128 c_common_parse_file()
        ???:0
```

See https://compiler-explorer.com/z/GKd834v8x.

Reply via email to