Commit a82f93ac by Steve Ellcey Committed by Steve Ellcey

re PR c++/28432 (duplicate "no member function declared" message)

	PR c++/28432
	* decl2.c (check_classfn): Remove early return.
	* search.c (lookup_member): Return NULL with bad type.
	* g++.dg/other/pr28304.C: Change expected error message.
	* g++.dg/other/pr28432.C: New test.

From-SVN: r115857
parent f47165c9
2006-08-01 Steve Ellcey <sje@cup.hp.com> 2006-08-01 Steve Ellcey <sje@cup.hp.com>
PR c++/28432
* decl2.c (check_classfn): Remove early return.
* search.c (lookup_member): Return NULL with bad type.
2006-08-01 Steve Ellcey <sje@cup.hp.com>
PR c++/28256 PR c++/28256
* decl.c (check_initializer): Check for 1 initializer on scalar types. * decl.c (check_initializer): Check for 1 initializer on scalar types.
......
...@@ -673,11 +673,8 @@ check_classfn (tree ctype, tree function, tree template_parms) ...@@ -673,11 +673,8 @@ check_classfn (tree ctype, tree function, tree template_parms)
else if (!COMPLETE_TYPE_P (ctype)) else if (!COMPLETE_TYPE_P (ctype))
cxx_incomplete_type_error (function, ctype); cxx_incomplete_type_error (function, ctype);
else else
{
error ("no %q#D member function declared in class %qT", error ("no %q#D member function declared in class %qT",
function, ctype); function, ctype);
return NULL_TREE;
}
/* If we did not find the method in the class, add it to avoid /* If we did not find the method in the class, add it to avoid
spurious errors (unless the CTYPE is not yet defined, in which spurious errors (unless the CTYPE is not yet defined, in which
......
...@@ -1209,7 +1209,8 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type) ...@@ -1209,7 +1209,8 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type)
} }
else else
{ {
gcc_assert (IS_AGGR_TYPE_CODE (TREE_CODE (xbasetype))); if (!IS_AGGR_TYPE_CODE (TREE_CODE (xbasetype)))
return NULL_TREE;
type = xbasetype; type = xbasetype;
xbasetype = NULL_TREE; xbasetype = NULL_TREE;
} }
......
2006-08-01 Steve Ellcey <sje@cup.hp.com> 2006-08-01 Steve Ellcey <sje@cup.hp.com>
PR c++/28432
* g++.dg/other/pr28304.C: Change expected error message.
* g++.dg/other/pr28432.C: New test.
2006-08-01 Steve Ellcey <sje@cup.hp.com>
PR c++/28256 PR c++/28256
* g++.dg/init/brace2.C: Change expected error message, add empty init. * g++.dg/init/brace2.C: Change expected error message, add empty init.
...@@ -7,5 +7,5 @@ template<typename T> void A::foo(T) {} // { dg-error "" } ...@@ -7,5 +7,5 @@ template<typename T> void A::foo(T) {} // { dg-error "" }
void bar() void bar()
{ {
A::foo(1); // { dg-error "not a member" } A::foo(1); // { dg-error "no matching function for call" }
} }
// Test to make sure we do not ICE on this invalid program.
// { dg-options "" }
struct A {};
void A::foo(); // { dg-error "member function declared in class|outside of class is not definition" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment