https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89422
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> --- Author: jason Date: Fri Mar 8 18:22:20 2019 New Revision: 269503 URL: https://gcc.gnu.org/viewcvs?rev=269503&root=gcc&view=rev Log: PR c++/89422 - ICE with -g and lambda in default arg in template. Here, we were trying to instantiate the default argument before setting DECL_FRIEND_CONTEXT, so that the instantiated lambda ended up being treated as part of the S template, which confused dwarf2out. * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner. Added: branches/gcc-8-branch/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg9.C Modified: branches/gcc-8-branch/gcc/cp/ChangeLog branches/gcc-8-branch/gcc/cp/pt.c