https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80873
Bug ID: 80873 Summary: ICE in tsubst_copy when trying to use an overloaded function without a definition in a lambda Product: gcc Version: 7.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: hafnermorris at gmail dot com Target Milestone: --- Created attachment 41411 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41411&action=edit Minimal example code The following invalid code causes an ICE: struct S {}; auto overloaded(S &); template <typename T> int overloaded(T &) { return 0; } template <typename T> auto returns_lambda(T ¶m) { return [&] { overloaded(param); }; } int main() { S s; returns_lambda(s); } On Wandbox: https://wandbox.org/permlink/bU36doHcn0MoXWrK Only gcc versions 7.1 and up seem to be affected. No compiler flags are required.