https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126020
Bug ID: 126020
Summary: ICE when instantiating a nested class template with a
deduced non-static data member
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/MnGvvfz34
Reproducer(from
https://github.com/k-arrows/clang-assert-tests/blob/main/experimental/gcc/00040.cpp):
```
template <typename T1> struct A {
template <typename T2> struct B {
auto y;
};
};
A<int>::B x(42);
```
Backtrace:
<source>:3:5: error: non-static data member declared with placeholder 'auto'
[-Wtemplate-body]
3 | auto y;
| ^~~~
<source>:7:15: internal compiler error: in build_deduction_guide, at
cp/pt.cc:31778
7 | A<int>::B x(42);
| ^
0x2a1f758 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x2a1439b internal_error(char const*, ...)
???:0
0xb36178 fancy_abort(char const*, int, char const*)
???:0
0xdb0e5e do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int, tree_node*)
???:0
0xc45df1 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int,
cp_decomp*)
???:0
0xd89ca3 c_parse_file()
???:0
0xf1a489 c_common_parse_file()
???:0
This goes back to gcc-16:
https://godbolt.org/z/onfccnePd