https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123676
Bug ID: 123676
Summary: [13/14/15/16 Regression] ICE in tsubst_pack_expansion
with lambda template parameter pack in trailing return
type decltype
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/zhxh8r8qe
The following c++ code crash gcc trunk with -std=c++20 flag.
Goes back to 12.1 without checking.
Clang accepts the code.
Code:
```cpp
template <typename...>
concept True = true;
int main() {
[]<typename... Args> -> decltype(True<Args...>) {};
}
```
Stack dump:
```
<source>: In function 'int main()':
<source>:4:24: warning: parameter declaration before lambda trailing return
type only optional with '-std=c++23' or '-std=gnu++23' [-Wc++23-extensions]
4 | []<typename... Args> -> decltype(True<Args...>) {};
| ^~
<source>:4:36: internal compiler error: in tsubst_pack_expansion, at
cp/pt.cc:14149
4 | []<typename... Args> -> decltype(True<Args...>) {};
| ^~~~~~~~~~~~~
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
0xdaa409 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
???:0
0xdada24 tsubst_argument_pack(tree_node*, tree_node*, int, tree_node*)
???:0
0xdaa3a4 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
???:0
0xd973ed instantiate_non_dependent_expr(tree_node*, int)
???:0
0xe0c358 finish_decltype_type(tree_node*, bool, int)
???:0
0xd64c03 c_parse_file()
???:0
0xeeed49 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
```