diff options
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/debug/dwarf2/pr46527.C | 18 |
4 files changed, 31 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6daf31b..f5d612d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +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 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 3e8b62c..c4b4a03 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 63c2d0b..bb3cada 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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. diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr46527.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr46527.C new file mode 100644 index 0000000..dfc983b --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr46527.C @@ -0,0 +1,18 @@ +// 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(); +} |