https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87765
Bug ID: 87765 Summary: Internal compiler error: coerce_template_parms (8.2) or cxx_eval_constant_expression (trunk) Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: curlypaul924 at gmail dot com Target Milestone: --- The following syntactically valid program produces an ICE in coerce_template_parms on gcc 8.2: template <int N> using foo = int; struct A { constexpr int bar() const { return 42; } }; void baz(A a) { [=](auto c) { return foo<a.bar()> { }; }; } creduce produced a syntactically invalid program which also causes ICE: template <int N> using foo = int; struct A { int bar(); }; void baz(A a) { [](auto foo<a.bar()> } x86-64 gcc trunk on godbolt.org also ICEs, but in cxx_eval_constant_expression. Clang accepts the first snippet, but gcc 7.3 rejects it with "error: '__closure' is not a constant expression". Possibly related to (or duplicate of) Bug 86960.