Bug 28432 - [4.0/4.1/4.2 regression] duplicate "no member function declared" message
Summary: [4.0/4.1/4.2 regression] duplicate "no member function declared" message
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P4 normal
Target Milestone: 4.0.4
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic, monitored
Depends on:
Blocks:
 
Reported: 2006-07-19 10:41 UTC by Volker Reichelt
Modified: 2006-08-03 17:17 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-07-19 10:41:18 UTC
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?
Comment 1 Steve Ellcey 2006-07-19 20:47:15 UTC
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.
Comment 2 Steve Ellcey 2006-08-01 16:45:29 UTC
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

Comment 3 Steve Ellcey 2006-08-03 17:10:09 UTC
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

Comment 4 Steve Ellcey 2006-08-03 17:16:29 UTC
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

Comment 5 Steve Ellcey 2006-08-03 17:17:35 UTC
Fixed on mainline, 4.1 branch, and 4.0 branch.