From 72e4661a2548a1fd0bf227ee81c38363da0e6900 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Mon, 21 Mar 2005 11:49:32 +0000 Subject: [PATCH] re PR c++/20461 (ICE at "class 'C' does not have any field named 'f'" error) 2005-03-21 Paolo Carlini PR c++/20461 PR c++/20536 * init.c (emit_mem_initializers): Don't crash on undefined types. 2005-03-21 Paolo Carlini PR c++/20147 * semantics.c (finish_stmt_expr_expr): Return immediately if error_operand_p (expr). From-SVN: r96784 --- gcc/cp/ChangeLog | 13 +++++++++++++ gcc/cp/init.c | 5 +++++ gcc/cp/semantics.c | 3 +++ 3 files changed, 21 insertions(+) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 76c1305bea6..1f79100a21d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,16 @@ +2005-03-21 Paolo Carlini + + PR c++/20461 + PR c++/20536 + * init.c (emit_mem_initializers): Don't crash on undefined + types. + +2005-03-21 Paolo Carlini + + PR c++/20147 + * semantics.c (finish_stmt_expr_expr): Return immediately + if error_operand_p (expr). + 2005-03-21 Joseph S. Myers * cp-tree.h (lvalue_or_else, lvalue_p): New. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index c526bb14511..ddf39bfd690 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -655,6 +655,11 @@ sort_mem_initializers (tree t, tree mem_inits) void emit_mem_initializers (tree mem_inits) { + /* We will already have issued an error message about the fact that + the type is incomplete. */ + if (!COMPLETE_TYPE_P (current_class_type)) + return; + /* Sort the mem-initializers into the order in which the initializations should be performed. */ mem_inits = sort_mem_initializers (current_class_type, mem_inits); diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 15762cb7883..f0dc8c2f7d6 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1523,6 +1523,9 @@ finish_stmt_expr_expr (tree expr, tree stmt_expr) { tree result = NULL_TREE; + if (error_operand_p (expr)) + return error_mark_node; + if (expr) { if (!processing_template_decl && !VOID_TYPE_P (TREE_TYPE (expr)))