https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95317
Bug ID: 95317 Summary: [7 regression] ICE on valid C++14 code, in tsubst_copy, at cp/pt.c:15649 Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: fxcoudert at gcc dot gnu.org Target Milestone: --- ICE on valid C++14 code: $ cat b.C #include <iostream> template <int I> struct num { enum { value = I }; }; #define VALUEOFNUM(x) std::remove_reference_t<decltype(x)>::value template <typename TYPE> void foo() { auto test = [&](auto i) { enum { VALUE = VALUEOFNUM(i) }; std::cout << VALUE; }; test(num<0>()); test(num<1>()); } int main() { foo<void>(); } $ g++-9 b.C b.C: In instantiation of 'void foo() [with TYPE = void]': b.C:27:15: required from here b.C:18:22: internal compiler error: in tsubst_copy, at cp/pt.c:15649 18 | std::cout << VALUE; | ^~~~~ libbacktrace could not find executable to open Please submit a full bug report, with preprocessed source if appropriate. See <https://github.com/Homebrew/homebrew-core/issues> for instructions. Works fine with GCC up to version 6, but regresses at 7 and later.