aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2003-05-21 14:27:46 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2003-05-21 14:27:46 +0000
commitb190f239060ec7ac9cb71d1c75303bf730cd6773 (patch)
tree8b4db981fce7368eec77eb662d5ca0d416cfc72a /gcc/cp
parent278566a23524383e61cfdd0b1e346ac55790975d (diff)
downloadgcc-b190f239060ec7ac9cb71d1c75303bf730cd6773.zip
gcc-b190f239060ec7ac9cb71d1c75303bf730cd6773.tar.gz
gcc-b190f239060ec7ac9cb71d1c75303bf730cd6773.tar.bz2
c-parse.in (fndef): Set DECL_SOURCE_LINE and FILE earlier.
* c-parse.in (fndef): Set DECL_SOURCE_LINE and FILE earlier. (nested_function): Likewise. (notype_nested_function): Likewise. cp: * pt.c (register_specialization): Update the decl's location, if necessary. (check_explicit_specialization): Likewise. From-SVN: r67063
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c13
2 files changed, 18 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 270103b..d0e9051 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2003-05-21 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (register_specialization): Update the decl's location,
+ if necessary.
+ (check_explicit_specialization): Likewise.
+
2003-05-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* error.c (dump_expr): Use HOST_WIDE_INT_PRINT_DOUBLE_HEX.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index e7feab6..c86a157 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1041,7 +1041,12 @@ register_specialization (spec, tmpl, args)
}
else if (DECL_TEMPLATE_SPECIALIZATION (fn))
{
- duplicate_decls (spec, fn);
+ if (!duplicate_decls (spec, fn) && DECL_INITIAL (spec))
+ /* Dup decl failed, but this is a new
+ definition. Set the line number so any errors
+ match this new definition. */
+ DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (spec);
+
return fn;
}
}
@@ -1851,6 +1856,12 @@ check_explicit_specialization (declarator, decl, template_count, flags)
{
SET_DECL_TEMPLATE_SPECIALIZATION (tmpl);
DECL_INITIAL (DECL_TEMPLATE_RESULT (tmpl)) = NULL_TREE;
+ if (have_def)
+ {
+ DECL_SOURCE_LOCATION (tmpl) = DECL_SOURCE_LOCATION (decl);
+ DECL_SOURCE_LOCATION (DECL_TEMPLATE_RESULT (tmpl))
+ = DECL_SOURCE_LOCATION (decl);
+ }
return tmpl;
}