This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: PR 13438
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 21 Dec 2003 23:56:48 -0800
- Subject: C++ PATCH: PR 13438
- Reply-to: mark at codesourcery dot com
This patch fixes an ICE in the new parser's error-handling code by
removing some old crud from the C++ front end. It's always nice when
fixing a bug requires just deleting code. :-)
Tested on i686-pc-linux-gnu, applied on the mainline.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
2003-12-21 Mark Mitchell <mark@codesourcery.com>
PR c++/13438
* cp-tree.h (cp_tree_index): Remove CPTI_RECORD_TYPE,
CPTI_UNION_TYPE, CPTI_ENUM_TYPE.
(record_type_node): Remove.
(union_type_node): Likewise.
(enum_type_node): Likewise.
* decl.c: Remove mention of above tree nodes in comment.
* lex.c (cxx_init): Do not assign to record_type_node,
union_type_node, or enum_type_node. Simplify handling of
class_type_node.
2003-12-21 Mark Mitchell <mark@codesourcery.com>
PR c++/13438
* g++.dg/parse/error8.C: New test.
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.941
diff -c -5 -p -r1.941 cp-tree.h
*** cp/cp-tree.h 21 Dec 2003 21:07:29 -0000 1.941
--- cp/cp-tree.h 22 Dec 2003 07:58:40 -0000
*************** enum cp_tree_index
*** 519,531 ****
CPTI_VMI_CLASS_DESC_TYPE,
CPTI_PTM_DESC_TYPE,
CPTI_BASE_DESC_TYPE,
CPTI_CLASS_TYPE,
- CPTI_RECORD_TYPE,
- CPTI_UNION_TYPE,
- CPTI_ENUM_TYPE,
CPTI_UNKNOWN_TYPE,
CPTI_VTBL_TYPE,
CPTI_VTBL_PTR_TYPE,
CPTI_STD,
CPTI_ABI,
--- 519,528 ----
*************** extern GTY(()) tree cp_global_trees[CPTI
*** 600,612 ****
#define vmi_class_desc_type_node cp_global_trees[CPTI_VMI_CLASS_DESC_TYPE]
#define ptm_desc_type_node cp_global_trees[CPTI_PTM_DESC_TYPE]
#define base_desc_type_node cp_global_trees[CPTI_BASE_DESC_TYPE]
#define class_type_node cp_global_trees[CPTI_CLASS_TYPE]
- #define record_type_node cp_global_trees[CPTI_RECORD_TYPE]
- #define union_type_node cp_global_trees[CPTI_UNION_TYPE]
- #define enum_type_node cp_global_trees[CPTI_ENUM_TYPE]
#define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
#define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
#define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
#define std_node cp_global_trees[CPTI_STD]
#define abi_node cp_global_trees[CPTI_ABI]
--- 597,606 ----
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1165
diff -c -5 -p -r1.1165 decl.c
*** cp/decl.c 21 Dec 2003 21:07:29 -0000 1.1165
--- cp/decl.c 22 Dec 2003 07:58:40 -0000
*************** tree error_mark_list;
*** 138,148 ****
tree ary_desc_type_node, func_desc_type_node, enum_desc_type_node;
tree class_desc_type_node, si_class_desc_type_node, vmi_class_desc_type_node;
tree ptm_desc_type_node;
tree base_desc_type_node;
! tree class_type_node, record_type_node, union_type_node, enum_type_node;
tree unknown_type_node;
Array type `vtable_entry_type[]'
tree vtbl_type_node;
--- 138,148 ----
tree ary_desc_type_node, func_desc_type_node, enum_desc_type_node;
tree class_desc_type_node, si_class_desc_type_node, vmi_class_desc_type_node;
tree ptm_desc_type_node;
tree base_desc_type_node;
! tree class_type_node;
tree unknown_type_node;
Array type `vtable_entry_type[]'
tree vtbl_type_node;
Index: cp/lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/lex.c,v
retrieving revision 1.320
diff -c -5 -p -r1.320 lex.c
*** cp/lex.c 19 Dec 2003 23:28:06 -0000 1.320
--- cp/lex.c 22 Dec 2003 07:58:40 -0000
*************** cxx_init (void)
*** 403,427 ****
init_method ();
init_error ();
current_function_decl = NULL;
! class_type_node = build_int_2 (class_type, 0);
! TREE_TYPE (class_type_node) = class_type_node;
! ridpointers[(int) RID_CLASS] = class_type_node;
!
! record_type_node = build_int_2 (record_type, 0);
! TREE_TYPE (record_type_node) = record_type_node;
! ridpointers[(int) RID_STRUCT] = record_type_node;
!
! union_type_node = build_int_2 (union_type, 0);
! TREE_TYPE (union_type_node) = union_type_node;
! ridpointers[(int) RID_UNION] = union_type_node;
!
! enum_type_node = build_int_2 (enum_type, 0);
! TREE_TYPE (enum_type_node) = enum_type_node;
! ridpointers[(int) RID_ENUM] = enum_type_node;
cxx_init_decl_processing ();
/* Create the built-in __null node. */
null_node = build_int_2 (0, 0);
--- 403,413 ----
init_method ();
init_error ();
current_function_decl = NULL;
! class_type_node = ridpointers[(int) RID_CLASS];
cxx_init_decl_processing ();
/* Create the built-in __null node. */
null_node = build_int_2 (0, 0);
Index: error8.C
===================================================================
RCS file: error8.C
diff -N error8.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- error8.C 22 Dec 2003 08:02:33 -0000
***************
*** 0 ****
--- 1,4 ----
+ // PR c++/13438
+
+ struct A { friend typename struct B; }; // { dg-error "" }
+