Since today, I get some duplicate diagnostics: ====================== struct A {}; void A::foo(); ====================== bug.cc:2: error: no 'void A::foo()' member function declared in class 'A' bug.cc:2: error: no 'void A::foo()' member function declared in class 'A' bug.cc:2: error: declaration of 'void A::foo()' outside of class is not definition Apparently we call check_classfn twice. Steve, the duplicate message appeared with your patch for PR 28304. But you probably only uncovered a latent problem. Would you mind taking a look, anyway?
Actually, I think my patch may have been wrong. By adding the return to check_classfn, what I basically did was to skip the call to add_method, which according to the comments, is specifically there to add the non-existent method and thus cause us to not give duplicate messages. If I undo the patch for PR 28304, we call add_method and the duplicate messages go away but then I have the ICE again. I think the ICE needs to be fixed some other way but I am not sure how to do it. I will think some more but any advice you might have would be appreciated.
Subject: Bug 28432 Author: sje Date: Tue Aug 1 16:45:14 2006 New Revision: 115857 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115857 Log: 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. Added: trunk/gcc/testsuite/g++.dg/other/pr28432.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl2.c trunk/gcc/cp/search.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/other/pr28304.C
Subject: Bug 28432 Author: sje Date: Thu Aug 3 17:09:57 2006 New Revision: 115906 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115906 Log: 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. Added: branches/gcc-4_1-branch/gcc/testsuite/g++.dg/other/pr28432.C Modified: branches/gcc-4_1-branch/gcc/cp/ChangeLog branches/gcc-4_1-branch/gcc/cp/decl2.c branches/gcc-4_1-branch/gcc/cp/search.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog branches/gcc-4_1-branch/gcc/testsuite/g++.dg/other/pr28304.C
Subject: Bug 28432 Author: sje Date: Thu Aug 3 17:16:20 2006 New Revision: 115908 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115908 Log: 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. Added: branches/gcc-4_0-branch/gcc/testsuite/g++.dg/other/pr28432.C Modified: branches/gcc-4_0-branch/gcc/cp/ChangeLog branches/gcc-4_0-branch/gcc/cp/decl2.c branches/gcc-4_0-branch/gcc/cp/search.c branches/gcc-4_0-branch/gcc/testsuite/ChangeLog branches/gcc-4_0-branch/gcc/testsuite/g++.dg/other/pr28304.C
Fixed on mainline, 4.1 branch, and 4.0 branch.