https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125437
Bug ID: 125437
Summary: ICE when parsing dependent return type E::T inside
class template with enum
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/xWc7ardcW
Reproducer:
```
template <typename T> class C {
enum class E { e };
E::T foo() { return E::e; }
};
```
Backtrace:
<source>:3:6: error: 'enum class C<T>::E' is not a class [-Wtemplate-body]
3 | E::T foo() { return E::e; }
| ^
<source>:3:6: internal compiler error: in constructor_name_p, at
cp/name-lookup.cc:5389
0x29e1d68 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x29d69ab internal_error(char const*, ...)
???:0
0xb2fdca fancy_abort(char const*, int, char const*)
???:0
0xd831b3 c_parse_file()
???:0
0xf122f9 c_common_parse_file()
???:0
Clang accepts this code:
https://godbolt.org/z/GWTvGnno7
This ICE goes back to gcc-12:
https://godbolt.org/z/qdMsn7sT1