https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92948
Bug ID: 92948 Summary: internal compiler error: in tsubst_copy, at cp/pt.c:15788 Product: gcc Version: 9.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: piotrsiupa at gmail dot com Target Milestone: --- Created attachment 47500 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47500&action=edit Minimal and complete example There is a bug in the experimental feature "non-type template parameters of class type" in c++2a. class Aaa { public: constexpr Aaa(const int) {} }; template<Aaa AAA> class Bbb_ { public: using ZZZ = unsigned; }; template<Aaa AAA> using Bbb = Bbb_<AAA>; template<int XXX, typename YYY = typename Bbb<XXX>::ZZZ> int foo() { return 0; } The error is: ./crash-the-compiler.cpp: In substitution of 'template<Aaa AAA> using Bbb = Bbb_<((const Aaa)AAA)> [with Aaa AAA = ((Aaa*)(void)0)->Aaa::Aaa(XXX)]': ./crash-the-compiler.cpp:17:50: required from here ./crash-the-compiler.cpp:15:18: internal compiler error: in tsubst_copy, at cp/pt.c:15788 15 | using Bbb = Bbb_<AAA>; | ^~~ Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. The bug seems to be pretty consistent on different versions of GCC. I've found it in 9.2.0 but I can reproduce it in 9.1.0 and every 10.0.0 version that I've found on https://godbolt.org/. Even avr-g++ has the same exact problem.