Commit 3862bc3a by Jeffrey Yasskin Committed by Jeffrey Yasskin

Propagate the source location from a template function's definition to

any already-instantiated declarations.

	PR c++/46527
	* gcc/cp/pt.c (instantiate_decl): Propagate the template's
	location to its instance.
	* gcc/testsuite/g++.dg/debug/dwarf2/pr46527.C: New test.

From-SVN: r167104
parent 9959d572
2010-11-23 Jeffrey Yasskin <jyasskin@google.com>
PR c++/46527
* pt.c (instantiate_decl): Propagate the template's location to
its instance.
2010-11-20 Joseph Myers <joseph@codesourcery.com>
* name-lookup.c (handle_namespace_attrs): Don't check
......
......@@ -17152,6 +17152,8 @@ instantiate_decl (tree d, int defer_ok,
&& !DECL_NOT_REALLY_EXTERN (d))
mark_definable (d);
DECL_SOURCE_LOCATION (td) = DECL_SOURCE_LOCATION (code_pattern);
DECL_SOURCE_LOCATION (d) = DECL_SOURCE_LOCATION (code_pattern);
input_location = DECL_SOURCE_LOCATION (d);
/* If D is a member of an explicitly instantiated class template,
......
2010-11-23 Jeffrey Yasskin <jyasskin@google.com>
PR c++/46527
* g++.dg/debug/dwarf2/pr46527.C: New test.
2010-11-23 Iain Sandoe <iains@gcc.gnu.org>
* gcc.dg/darwin-cfstring-1.c: Adjust format messages.
......
// Origin: PR 46527
// { dg-do compile }
// { dg-options "-g -O0 -dA" }
template <typename T> struct Struct {
double defined_later();
};
struct WrapperStruct {
Struct<double> ClassInstantiated;
};
template <typename T> double
Struct<T>::defined_later() // { dg-function-on-line {_ZN6StructIdE13defined_laterEv} }
{
return 1;
}
void InstantiateMethod() {
Struct<double>().defined_later();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment