re PR c++/13663 (gcc segfaults on invalid use of member)

PR c++/13663
	* semantics.c (finish_for_expr): Check for unresolved overloaded
	functions.

	PR c++/13363
	* g++.dg/expr/for1.C: New test.

From-SVN: r76659
This commit is contained in:
Mark Mitchell 2004-01-26 20:11:46 +00:00 committed by Mark Mitchell
parent 044feeeba0
commit 6f69173e89
4 changed files with 30 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2004-01-26 Mark Mitchell <mark@codesourcery.com>
PR c++/13663
* semantics.c (finish_for_expr): Check for unresolved overloaded
functions.
* class.c (add_method): Just check processing_template_decl to
determine whether or not we are within a template.
* decl2.c (maybe_retrofit_in_chrg): Likewise.

View File

@ -678,6 +678,13 @@ finish_for_cond (tree cond, tree for_stmt)
void
finish_for_expr (tree expr, tree for_stmt)
{
/* If EXPR is an overloaded function, issue an error; there is no
context available to use to perform overload resolution. */
if (expr && type_unknown_p (expr))
{
cxx_incomplete_type_error (expr, TREE_TYPE (expr));
expr = error_mark_node;
}
FOR_EXPR (for_stmt) = expr;
}

View File

@ -1,3 +1,8 @@
2004-01-26 Mark Mitchell <mark@codesourcery.com>
PR c++/13363
* g++.dg/expr/for1.C: New test.
2004-01-26 Fariborz Jahanian <fjahanian@apple.com>
PR middle-end/13779

View File

@ -0,0 +1,14 @@
// PR c++/13663
struct S {
void f();
};
void g(int);
void g(double);
void h () {
S s;
for (;;s.f); // { dg-error "" }
for (;;g); // { dg-error "" }
}