https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100079
Bug ID: 100079 Summary: Non-type template parameter, itself a nested template, rejected with internal error Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mail at lboeger dot de Target Milestone: --- The following snippet triggers an internal compiler error. template <auto value> struct Foo { using SomeTypeAlias = int; Foo() {} }; template <class T> struct Bar { T value; constexpr Bar(const T& value) : value{value} {} }; template <int N> struct Baz {}; constexpr auto baz = Baz<42>{}; const Foo<Bar<Baz<42>>{baz}> test{}; test.cpp: In instantiation of 'struct Foo<Bar<Baz<42> >()>': test.cpp:6:5: required from 'Foo<value>::Foo() [with auto value = Bar<Baz<42> >{Baz<42>()}]' test.cpp:24:35: required from here test.cpp:3:12: internal compiler error: in finish_member_declaration, at cp/semantics.c:3237 3 | struct Foo { | ^ Interestingly, when removing the type alias Foo::SomeTypeAlias, this compiles as expected. In addition, defaulting the Foo constructor yields a different diagnostic: test.cpp: In instantiation of 'struct Foo<Bar<Baz<42> >{Baz<42>()}>': test.cpp:24:30: required from here test.cpp:6:5: error: defaulted declaration 'Foo<value>::Foo() [with auto value = Bar<Baz<42> >{Baz<42>()}]' does not match the expected signature 6 | Foo() = default; | ^~~ test.cpp:6:5: note: expected signature: 'constexpr Foo<Bar<Baz<42> >{Baz<42>()}>::Foo()' These results were produced with gcc-10.2.0_4 on MacOS, but it seems to be the same in 10.3 and trunk (see https://godbolt.org/z/PexPbq6cf)