Hi! This PR got fixed in r251433 which I'm afraid is not backportable, we were trying to register local specialization during dwarf2out_type_decl.
I've committed the testcase as obvious to trunk, so that we don't regress on it again: 2018-03-12 Jakub Jelinek <ja...@redhat.com> PR c++/84813 * g++.dg/debug/pr84813.C: New test. --- gcc/testsuite/g++.dg/debug/pr84813.C.jj 2018-03-12 09:57:50.197029595 +0100 +++ gcc/testsuite/g++.dg/debug/pr84813.C 2018-03-12 09:57:40.279028562 +0100 @@ -0,0 +1,33 @@ +// PR c++/84813 +// { dg-do compile } +// { dg-options "-g -std=c++14" } + +template <typename> +struct P {}; + +template <int> +struct F { + using type = int; +}; + +template <typename T> +void +apply () +{ + constexpr int N = T::N; + [] (typename F<N>::type) + { + auto f = [] () {}; + P<decltype (f)>{}; + }; +} + +struct A { + static constexpr int N = 1; +}; + +void +instantiate () +{ + apply<A> (); +} Jakub