aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-06-17 23:51:41 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-06-17 19:51:41 -0400
commit57f01f4575731517108645b3f5cc62e7be67c42f (patch)
tree92b9bd20ba7b98a2679d24c1e3820120a4512fa0 /gcc
parentca8c3b37127de3e245375f9dec492e913b675aeb (diff)
downloadgcc-57f01f4575731517108645b3f5cc62e7be67c42f.zip
gcc-57f01f4575731517108645b3f5cc62e7be67c42f.tar.gz
gcc-57f01f4575731517108645b3f5cc62e7be67c42f.tar.bz2
class.c (finish_struct): Make conflicting use of id a pedwarn.
* class.c (finish_struct): Make conflicting use of id a pedwarn. * decl.c (pushdecl_class_level): Likewise. From-SVN: r20552
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/class.c12
-rw-r--r--gcc/cp/decl.c10
3 files changed, 18 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5af8932..5218f1b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+1998-06-17 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (finish_struct): Make conflicting use of id a pedwarn.
+ * decl.c (pushdecl_class_level): Likewise.
+
1998-06-17 Mark Mitchell <mark@markmitchell.com>
* pt.c (convert_nontype_argument): Issue an error when presented
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 56c2984..0b3e2e0 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -4300,7 +4300,9 @@ finish_struct (t, list_of_fieldlists, attributes, warn_anon)
TREE_PROTECTED (DECL_RESULT (x)) = TREE_PROTECTED (x);
}
- /* Check for inconsistent use of this name in the class body.
+ /* A name N used in a class S shall refer to the same declaration
+ in its context and when re-evaluated in the completed scope of S.
+
Enums, types and static vars have already been checked. */
if (TREE_CODE (x) != TYPE_DECL && TREE_CODE (x) != USING_DECL
&& ! (TREE_CODE (x) == TEMPLATE_DECL
@@ -4325,10 +4327,10 @@ finish_struct (t, list_of_fieldlists, attributes, warn_anon)
&& !(TREE_CODE (icv) == TYPE_DECL
&& DECL_CONTEXT (icv) == t))
{
- cp_error_at ("declaration of identifier `%D' as `%+#D'",
- name, x);
- cp_error_at ("conflicts with other use in class as `%#D'",
- icv);
+ cp_pedwarn_at ("declaration of identifier `%D' as `%+#D'",
+ name, x);
+ cp_pedwarn_at ("conflicts with other use in class as `%#D'",
+ icv);
}
}
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 6e5b102..1aaa3de 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3726,7 +3726,9 @@ pushdecl_class_level (x)
{
if (TYPE_BEING_DEFINED (current_class_type))
{
- /* Check for inconsistent use of this name in the class body.
+ /* A name N used in a class S shall refer to the same declaration
+ in its context and when re-evaluated in the completed scope of S.
+
Types, enums, and static vars are checked here; other
members are checked in finish_struct. */
tree icv = IDENTIFIER_CLASS_VALUE (name);
@@ -3738,9 +3740,9 @@ pushdecl_class_level (x)
&& !(DECL_DECLARES_TYPE_P (icv)
&& DECL_CONTEXT (icv) == current_class_type))
{
- cp_error ("declaration of identifier `%D' as `%#D'", name, x);
- cp_error_at ("conflicts with previous use in class as `%#D'",
- icv);
+ cp_pedwarn ("declaration of identifier `%D' as `%#D'", name, x);
+ cp_pedwarn_at ("conflicts with previous use in class as `%#D'",
+ icv);
}
}