diff options
author | Steve Ellcey <sje@cup.hp.com> | 2006-08-01 16:45:14 +0000 |
---|---|---|
committer | Steve Ellcey <sje@gcc.gnu.org> | 2006-08-01 16:45:14 +0000 |
commit | a82f93ac13c4280fdf2b5d48648bfc3f7668406b (patch) | |
tree | 1419123d4eb2f44dcc0914f5ddf24a041af5c4c6 | |
parent | f47165c975758bb03b5427a0a72273e535189883 (diff) | |
download | gcc-a82f93ac13c4280fdf2b5d48648bfc3f7668406b.zip gcc-a82f93ac13c4280fdf2b5d48648bfc3f7668406b.tar.gz gcc-a82f93ac13c4280fdf2b5d48648bfc3f7668406b.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 7 | ||||
-rw-r--r-- | gcc/cp/search.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/pr28304.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/pr28432.C | 7 |
6 files changed, 24 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8fe52a9..a93e420 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 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 * decl.c (check_initializer): Check for 1 initializer on scalar types. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index faee0aa..8b39b81 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -673,11 +673,8 @@ check_classfn (tree ctype, tree function, tree template_parms) else if (!COMPLETE_TYPE_P (ctype)) cxx_incomplete_type_error (function, ctype); else - { - error ("no %q#D member function declared in class %qT", - function, ctype); - return NULL_TREE; - } + error ("no %q#D member function declared in class %qT", + function, ctype); /* 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 diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 50e704f..d54e607 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1209,7 +1209,8 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type) } else { - gcc_assert (IS_AGGR_TYPE_CODE (TREE_CODE (xbasetype))); + if (!IS_AGGR_TYPE_CODE (TREE_CODE (xbasetype))) + return NULL_TREE; type = xbasetype; xbasetype = NULL_TREE; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e1a69c1..097e784 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,11 @@ 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 * g++.dg/init/brace2.C: Change expected error message, add empty init. diff --git a/gcc/testsuite/g++.dg/other/pr28304.C b/gcc/testsuite/g++.dg/other/pr28304.C index 9a0e9cd..c86efd4 100644 --- a/gcc/testsuite/g++.dg/other/pr28304.C +++ b/gcc/testsuite/g++.dg/other/pr28304.C @@ -7,5 +7,5 @@ template<typename T> void A::foo(T) {} // { dg-error "" } void bar() { - A::foo(1); // { dg-error "not a member" } + A::foo(1); // { dg-error "no matching function for call" } } diff --git a/gcc/testsuite/g++.dg/other/pr28432.C b/gcc/testsuite/g++.dg/other/pr28432.C new file mode 100644 index 0000000..2b9c763 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/pr28432.C @@ -0,0 +1,7 @@ + +// 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" } |