https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88795
Bug ID: 88795 Summary: ICE on class-template argument deduction if non-type parameter has indirection Product: gcc Version: 7.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: programmer at posteo dot de Target Milestone: --- The following code (compiled with g++ -std=c++17 -Wall -Wextra) causes an internal compiler error (ICE) with all GCC versions on godbolt starting from 7.1. Clang compiles fine. // CODE START template<class, int> struct Array {}; template<class T, int size_> struct Foo { static constexpr int size() { return size_;// this indirection causes the ICE } template<class U> Foo(U, Array<T, size()>) {} }; template<class T, int size, class U> Foo(U, Array<T, size>) -> Foo<T, size>; int main() { Array<int, 2> arr{}; Foo foo{2.0, arr}; } // CODE END Below I post the error messages from godbolt in order to make it easier to find this report. See also https://godbolt.org/z/Nb-3YM GCC 9.0.0 20190109: internal compiler error: tree check: expected tree_list, have error_mark in type_hash_canon_hash, at tree.c:6811 GCC 8.2.0: internal compiler error: in type_unification_real, at cp/pt.c:20206 GCC 8.1.0: internal compiler error: in type_unification_real, at cp/pt.c:20148 [...] mmap: Invalid argument GCC 7.4.0: internal compiler error: in type_unification_real, at cp/pt.c:19294 GCC 7.3.0: internal compiler error: in type_unification_real, at cp/pt.c:19239 [...] mmap: Invalid argument GCC 7.2.0: internal compiler error: in type_unification_real, at cp/pt.c:19209 [...] mmap: Invalid argument GCC 7.1.0: internal compiler error: in type_unification_real, at cp/pt.c:19127 [...] mmap: Invalid argument