I am testing the following to fix PR70271 Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
Richard. 2016-03-17 Richard Biener <rguent...@suse.de> PR debug/70271 * dwarf2out.c (dwarf2out_early_finish): Process deferred_asm_name last. * g++.dg/debug/pr70271.C: New testcase. Index: gcc/dwarf2out.c =================================================================== *** gcc/dwarf2out.c (revision 234279) --- gcc/dwarf2out.c (working copy) *************** dwarf2out_finish (const char *filename) *** 27686,27695 **** static void dwarf2out_early_finish (void) { ! limbo_die_node *node; /* Add DW_AT_linkage_name for all deferred DIEs. */ ! for (node = deferred_asm_name; node; node = node->next) { tree decl = node->created_for; if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl) --- 27686,27700 ---- static void dwarf2out_early_finish (void) { ! /* The point here is to flush out the limbo list so that it is empty ! and we don't need to stream it for LTO. */ ! flush_limbo_die_list (); ! ! gen_scheduled_generic_parms_dies (); ! gen_remaining_tmpl_value_param_die_attribute (); /* Add DW_AT_linkage_name for all deferred DIEs. */ ! for (limbo_die_node *node = deferred_asm_name; node; node = node->next) { tree decl = node->created_for; if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl) *************** dwarf2out_early_finish (void) *** 27703,27715 **** } } deferred_asm_name = NULL; - - /* The point here is to flush out the limbo list so that it is empty - and we don't need to stream it for LTO. */ - flush_limbo_die_list (); - - gen_scheduled_generic_parms_dies (); - gen_remaining_tmpl_value_param_die_attribute (); } /* Reset all state within dwarf2out.c so that we can rerun the compiler --- 27708,27713 ---- Index: gcc/testsuite/g++.dg/debug/pr70271.C =================================================================== *** gcc/testsuite/g++.dg/debug/pr70271.C (revision 0) --- gcc/testsuite/g++.dg/debug/pr70271.C (working copy) *************** *** 0 **** --- 1,36 ---- + // { dg-do compile } + + template <typename Function> + struct function_traits + : public function_traits<decltype(&Function::operator())> + { }; + + template <typename ClassType, typename ReturnType, typename... Args> + struct function_traits<ReturnType(ClassType::*)(Args...) const> + { + typedef ReturnType (*pointer)(Args...); + typedef ReturnType return_type; + }; + + template <typename Function> + typename function_traits<Function>::pointer + FunctionPointer (const Function& lambda) + { + return static_cast<typename function_traits<Function>::pointer>(lambda); + } + + template <typename Function> + typename function_traits<Function>::return_type + GetReturnValue (Function func) + { + typename function_traits<Function>::return_type *dummy; + return *dummy; + } + template <typename T> class ClassFoo {}; + template <typename T> void FuncBar () { } + + template <> inline void FuncBar<double> () + { + typedef void (*func_type)(ClassFoo<double> &); + func_type f1 = FunctionPointer ([](ClassFoo<double> & ref) { }); + }