aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGiovanni Bajo <giovannibajo@gcc.gnu.org>2004-06-11 03:11:07 +0000
committerGiovanni Bajo <giovannibajo@gcc.gnu.org>2004-06-11 03:11:07 +0000
commitda291c876347aad7c585d2a7fe8a463af74dd422 (patch)
tree9ba96cc9ed790a443b2b29ef7885425e4af5fad6 /gcc
parent57ab9ac22c2b40b813269208072ede2452fb673a (diff)
downloadgcc-da291c876347aad7c585d2a7fe8a463af74dd422.zip
gcc-da291c876347aad7c585d2a7fe8a463af74dd422.tar.gz
gcc-da291c876347aad7c585d2a7fe8a463af74dd422.tar.bz2
typeck2.c (abstract_virtual_errors): Reword diagnostics, make them appear at the correct location.
* typeck2.c (abstract_virtual_errors): Reword diagnostics, make them appear at the correct location. * g++.old-deja/g++.robertl/eb4.C: Adjust error markers. * g++.old-deja/g++.other/decl3.C: Likewise. From-SVN: r82957
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/typeck2.c31
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/decl3.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.robertl/eb4.C2
5 files changed, 32 insertions, 15 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 278e4d4..6ab2a7a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2004-06-11 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ * typeck2.c (abstract_virtual_errors): Reword diagnostics, make them
+ appear at the correct location.
+
2004-06-10 Jason Merrill <jason@redhat.com>
PR c++/15875
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 2c6b843..5bf6d14 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -149,34 +149,41 @@ abstract_virtuals_error (tree decl, tree type)
return 0;
if (TREE_CODE (decl) == VAR_DECL)
- error ("cannot declare variable `%D' to be of type `%T'",
- decl, type);
+ cp_error_at ("cannot declare variable `%+D' to be of abstract "
+ "type `%T'", decl, type);
else if (TREE_CODE (decl) == PARM_DECL)
- error ("cannot declare parameter `%D' to be of type `%T'",
- decl, type);
+ cp_error_at ("cannot declare parameter `%+D' to be of abstract "
+ "type `%T'", decl, type);
else if (TREE_CODE (decl) == FIELD_DECL)
- error ("cannot declare field `%D' to be of type `%T'",
- decl, type);
+ cp_error_at ("cannot declare field `%+D' to be of abstract "
+ "type `%T'", decl, type);
else if (TREE_CODE (decl) == FUNCTION_DECL
&& TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
- error ("invalid return type for member function `%#D'", decl);
+ cp_error_at ("invalid abstract return type for member function `%+#D'",
+ decl);
else if (TREE_CODE (decl) == FUNCTION_DECL)
- error ("invalid return type for function `%#D'", decl);
+ cp_error_at ("invalid abstract return type for function `%+#D'",
+ decl);
+ else
+ cp_error_at ("invalid abstract type for `%+D'", decl);
}
else
- error ("cannot allocate an object of type `%T'", type);
+ error ("cannot allocate an object of abstract type `%T'", type);
/* Only go through this once. */
if (TREE_PURPOSE (u) == NULL_TREE)
{
TREE_PURPOSE (u) = error_mark_node;
- error (" because the following virtual functions are abstract:");
+ inform ("%J because the following virtual functions are pure "
+ "within `%T':", TYPE_MAIN_DECL (type), type);
+
for (tu = u; tu; tu = TREE_CHAIN (tu))
- cp_error_at ("\t%#D", TREE_VALUE (tu));
+ inform ("%J\t%#D", TREE_VALUE (tu), TREE_VALUE (tu));
}
else
- error (" since type `%T' has abstract virtual functions", type);
+ inform ("%J since type `%T' has pure virtual functions",
+ TYPE_MAIN_DECL (type), type);
return 1;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b8514dc..d54502a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-06-11 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ * g++.old-deja/g++.robertl/eb4.C: Adjust error markers.
+ * g++.old-deja/g++.other/decl3.C: Likewise.
+
2004-06-10 Brian Booth <bbooth@redhat.com>
* gcc.dg/tree-ssa/20031015-1.c: Scan for
diff --git a/gcc/testsuite/g++.old-deja/g++.other/decl3.C b/gcc/testsuite/g++.old-deja/g++.other/decl3.C
index fbf2076..a03d2e9 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/decl3.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/decl3.C
@@ -6,8 +6,8 @@
// We should not allow arrays of abstract type. [class.abstract/2]
-struct cow_t {
- virtual void f()=0; // { dg-error "" } abstract
+struct cow_t { // { dg-error "" } note
+ virtual void f()=0; // { dg-error "" } pure
};
diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb4.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb4.C
index 6496fc9..f47d3db 100644
--- a/gcc/testsuite/g++.old-deja/g++.robertl/eb4.C
+++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb4.C
@@ -17,7 +17,7 @@ public:
};
class some_derived : public some_base
- {
+ { // { dg-error "" } note
public:
class derived_func_args;
void func(derived_func_args &);