Bug 44756 - g++ ignores parameter names in class method declaration
g++ ignores parameter names in class method declaration
Status: CLOSED UPSTREAM
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
8.0
i386 Linux
medium Severity low
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-06-15 23:13 EDT by Wagner T. Correa
Modified: 2007-04-18 12:33 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-01 18:49:58 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Wagner T. Correa 2001-06-15 23:13:32 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.2-2 i686)

Description of problem:
The following program compiles without a warning:

class foo {
public:
	int sum(int x, int x);	// shouldn't it give an error here?
};

//int foo::sum(int x, int x)	// it does here
int foo::sum(int x, int y)
{
	return x + y;
}


How reproducible:
Always

Steps to Reproduce:
1. g++ -c -g -Wall foo.cpp


Actual Results:  g++ compiles the code without any warning.

Expected Results:  I'd expect g++ to give me an error.  At least a warning.

Additional info:

rpm -q gcc
gcc-2.96-81
Comment 1 Michael Schwendt 2001-06-22 21:51:04 EDT
Consider this:

struct bar {
    int sum(int, int);  // Any reason to give an error/warning here?
};

Comment 2 Richard Henderson 2004-10-01 18:49:58 EDT
I agree this should be diagnosed.  Pushed upstream so that C++ language
lawyers can have a go at it.  Probably won't be fixed until gcc 4.1
though.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17786

Note You need to log in before you can comment on or make changes to this bug.