This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH:ICE with qualifier names
- To: Jason Merrill <jason at cygnus dot com>
- Subject: Re: C++ PATCH:ICE with qualifier names
- From: Nathan Sidwell <nathan at acm dot org>
- Date: Wed, 25 Aug 1999 13:11:43 +0100
- CC: nathan at compsci dot bristol dot ac dot uk, egcs-patches at egcs dot cygnus dot com
- Organization: University of Bristol
- References: <37284070.7ACB6FDA@acm.org> <u94shpkkay.fsf@yorick.cygnus.com>
- Reply-To: nathan at compsci dot bristol dot ac dot uk
Jason Merrill wrote:
>
> This is OK.
(from http://egcs.cygnus.com/ml/gcc-patches/1999-04/msg01099.html)
I applied the attached patch and new testcase. Since the original patch was
sent,
1999-05-24 Mark Mitchell <mark@codesourcery.com>
* decl2.c (handle_class_head): Make error-recovery more robust.
dinked the code a bit, but that still ICE's on the testcase. this one's even
nicer!
nathan
--
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
I have seen the death of PhotoShop -- it is called GIMP
nathan@acm.org http://www.cs.bris.ac.uk/~nathan/ nathan@cs.bris.ac.uk
Index: gcc/cp/ChangeLog
===================================================================
RCS file: /cvs/egcs/egcs/gcc/cp/ChangeLog,v
retrieving revision 1.1205
diff -c -3 -p -r1.1205 ChangeLog
*** ChangeLog 1999/08/24 21:23:51 1.1205
--- ChangeLog 1999/08/25 11:49:25
***************
*** 1,3 ****
--- 1,8 ----
+ 1999-08-25 Nathan Sidwell <nathan@acm.org>
+
+ * decl2.c (handle_class_head): Be graceful about additional
+ scope qualifiers. Adjust comments to reflect reality.
+
1999-08-24 Jason Merrill <jason@yorick.cygnus.com>
* call.c (build_conditional_expr): Fix typo.
Index: gcc/cp/decl2.c
===================================================================
RCS file: /cvs/egcs/egcs/gcc/cp/decl2.c,v
retrieving revision 1.241
diff -c -3 -p -r1.241 decl2.c
*** decl2.c 1999/08/19 21:19:37 1.241
--- decl2.c 1999/08/25 11:49:29
*************** handle_class_head (aggr, scope, id)
*** 5235,5253 ****
decl = DECL_TEMPLATE_RESULT (id);
else
{
! if (scope)
! {
! cp_error ("`%T' does not have a nested type named `%D'", scope, id);
! return error_mark_node;
! }
else
cp_error ("no file-scope type named `%D'", id);
! decl = TYPE_MAIN_DECL (xref_tag (aggr, make_anon_name (), 1));
}
!
! /* This syntax is only allowed when we're defining a type, so we
! enter the SCOPE. */
push_scope (CP_DECL_CONTEXT (decl));
/* If we see something like:
--- 5235,5267 ----
decl = DECL_TEMPLATE_RESULT (id);
else
{
! tree current = current_scope();
!
! if (current == NULL_TREE)
! current = current_namespace;
! if (scope == std_node)
! scope = global_namespace;
! if (scope == NULL_TREE)
! scope = global_namespace;
! if (scope == current)
! {
! /* We've been given AGGR SCOPE::ID, when we're already inside SCOPE.
! Be nice about it. */
! if (pedantic)
! cp_pedwarn ("extra qualification `%T::' on member `%D' ignored",
! FROB_CONTEXT (scope), id);
! }
! else if (scope != global_namespace)
! cp_error ("`%T' does not have a nested type named `%D'", scope, id);
else
cp_error ("no file-scope type named `%D'", id);
! /* Inject it at the current scope. */
! decl = TYPE_MAIN_DECL (xref_tag (aggr, id, 1));
}
!
! /* Enter the SCOPE. If this turns out not to be a definition, the
! parser must leave the scope. */
push_scope (CP_DECL_CONTEXT (decl));
/* If we see something like:
Index: gcc/testsuite/ChangeLog
===================================================================
RCS file: /cvs/egcs/egcs/gcc/testsuite/ChangeLog,v
retrieving revision 1.311
diff -c -3 -p -r1.311 ChangeLog
*** ChangeLog 1999/08/24 13:21:45 1.311
--- ChangeLog 1999/08/25 11:50:28
***************
*** 1,3 ****
--- 1,7 ----
+ 1999-08-25 Nathan Sidwell <nathan@acm.org>
+
+ * g++.old-deja/g++.other/decl5.C: New test.
+
1999-08-24 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* noncompile/noncompile.exp: Load_lib c-torture.exp.
Index: gcc/testsuite/g++.old-deja/g++.other/decl5.C
===================================================================
RCS file: decl5.C
diff -N decl5.C
*** /dev/null Sat Dec 5 20:30:03 1998
--- decl5.C Wed Aug 25 04:50:28 1999
***************
*** 0 ****
--- 1,78 ----
+ // Build don't link:
+
+ // Copyright (C) 1999 Free Software Foundation, Inc.
+ // Contributed by Nathan Sidwell 22 Apr 1999 <nathan@acm.org>
+ // derived from a bug report by <rch@larissa.sd.bi.ruhr-uni-bochum.de>
+ // http://egcs.cygnus.com/ml/egcs-bugs/1999-04/msg00626.html
+ // the code is wrong, but we fell over badly
+
+
+ struct A {
+ int A::fn(); // WARNING - extra qualification
+ int A::m; // WARNING - extra qualification
+ struct e;
+ struct A::e {int i;};
+ struct A::expand { // WARNING - extra qualification
+ int m;
+ };
+ struct Z;
+ expand me;
+ void foo(struct A::e);
+ void foo(struct A::z); // WARNING - extra qualification
+ };
+
+ struct Q;
+ struct B {
+ struct A::fink { // ERROR - no such member
+ int m;
+ };
+ struct A::Z { // ERROR XFAIL - A::Z not a member of B
+ int m;
+ };
+ int m;
+ int n;
+ struct ::Q { // ERROR XFAIL - ::Q not a member of B
+ int m;
+ };
+ int A::fn() { // ERROR - A::fn not a member of B
+ return 0;
+ }
+ void fn(struct ::Q &);
+ void foo(struct A::y); // ERROR - no such member
+ };
+
+ struct ::C { // WARNING - extra qualification
+ int i;
+ };
+
+ namespace N {
+ int fn();
+ struct F;
+ }
+
+ namespace NMS
+ {
+ void NMS::fn(); // WARNING - extra qualification XFAIL
+ int NMS::i; // WARNING - extra qualification XFAIL
+ struct NMS::D { // WARNING - extra qualification
+ int i;
+ };
+ struct N::E { // ERROR - no such type
+ int i;
+ };
+ struct ::F { // ERROR - no such type
+ int i;
+ };
+ int N::fn() { // ERROR - N::fn not a member of NMS
+ return 0;
+ }
+ struct N::F { // ERROR XFAIL - N::F not a member of NMS
+ int i;
+ };
+ }
+
+ NMS::D thing;
+ void NMS::fn()
+ {
+ i = 3;
+ }