name-lookup.c (check_for_out_of_scope_variable): Avoid ICE by returning when TREE_TYPE is error_mark_node.

* name-lookup.c (check_for_out_of_scope_variable): Avoid ICE by
	returning when TREE_TYPE is error_mark_node.
	* typeck.c (require_complete_type): Return error_mark_node if
	value's type is an error_mark_node.

	* g++.dg/lookup/forscope2.C: New test case.

From-SVN: r82133
This commit is contained in:
Roger Sayle 2004-05-22 13:56:19 +00:00
parent b7e6a6b3f5
commit ae5cbc332f
5 changed files with 28 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2004-05-22 Roger Sayle <roger@eyesopen.com>
* name-lookup.c (check_for_out_of_scope_variable): Avoid ICE by
returning when TREE_TYPE is error_mark_node.
* typeck.c (require_complete_type): Return error_mark_node if
value's type is an error_mark_node.
2005-05-20 Andrew Pinski <pinskia@physics.uc.edu>
* optimize.c (calls_setjmp_r): Remove.

View File

@ -1151,6 +1151,10 @@ check_for_out_of_scope_variable (tree decl)
return decl;
DECL_ERROR_REPORTED (decl) = 1;
if (TREE_TYPE (decl) == error_mark_node)
return decl;
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
{
error ("name lookup of `%D' changed for new ISO `for' scoping",

View File

@ -96,6 +96,9 @@ require_complete_type (tree value)
else
type = TREE_TYPE (value);
if (type == error_mark_node)
return error_mark_node;
/* First, detect a valid value with a complete type. */
if (COMPLETE_TYPE_P (type))
return value;

View File

@ -1,3 +1,8 @@
2004-05-22 Wolfgang Bangerth <bangerth@dealii.org>
Roger Sayle <roger@eyesopen.com>
* g++.dg/lookup/forscope2.C: New test case.
2004-05-22 Ben Elliston <bje@au.ibm.com>
* gcc.dg/cpp/Wmissingdirs.c: New.

View File

@ -0,0 +1,9 @@
// { dg-do compile }
struct S {
void foo() {
for (_ptr; ;) {} // { dg-error "not declared" }
_ptr = 0;
}
};