diff options
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r-- | gcc/cp/class.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index c7ea3f4..09633b8 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1217,10 +1217,11 @@ add_method (tree type, tree method, bool via_using) continue; } error_at (DECL_SOURCE_LOCATION (method), - "%q#D", method); - error_at (DECL_SOURCE_LOCATION (fn), - "conflicts with version inherited from %qT", - basef); + "%q#D conflicts with version inherited from %qT", + method, basef); + inform (DECL_SOURCE_LOCATION (fn), + "version inherited from %qT declared here", + basef); } /* Otherwise defer to the other function. */ return false; @@ -1238,8 +1239,10 @@ add_method (tree type, tree method, bool via_using) } else { - error ("%q+#D cannot be overloaded", method); - error ("with %q+#D", fn); + error_at (DECL_SOURCE_LOCATION (method), + "%q#D cannot be overloaded with %q#D", method, fn); + inform (DECL_SOURCE_LOCATION (fn), + "previous declaration %q#D", fn); return false; } } @@ -1371,16 +1374,21 @@ handle_using_decl (tree using_decl, tree t) the same name already present in the current class. */; else { - error ("%q+D invalid in %q#T", using_decl, t); - error (" because of local method %q+#D with same name", - old_value); + error_at (DECL_SOURCE_LOCATION (using_decl), "%qD invalid in %q#T " + "because of local method %q#D with same name", + using_decl, t, old_value); + inform (DECL_SOURCE_LOCATION (old_value), + "local method %q#D declared here", old_value); return; } } else if (!DECL_ARTIFICIAL (old_value)) { - error ("%q+D invalid in %q#T", using_decl, t); - error (" because of local member %q+#D with same name", old_value); + error_at (DECL_SOURCE_LOCATION (using_decl), "%qD invalid in %q#T " + "because of local member %q#D with same name", + using_decl, t, old_value); + inform (DECL_SOURCE_LOCATION (old_value), + "local member %q#D declared here", old_value); return; } |