Bug 44756 - g++ ignores parameter names in class method declaration
Summary: g++ ignores parameter names in class method declaration
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 8.0
Hardware: i386
OS: Linux
medium
low
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-06-16 03:13 UTC by Wagner T. Correa
Modified: 2007-04-18 16:33 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-10-01 22:49:58 UTC
Embargoed:


Attachments (Terms of Use)

Description Wagner T. Correa 2001-06-16 03:13:32 UTC
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-23 01:51:04 UTC
Consider this:

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



Comment 2 Richard Henderson 2004-10-01 22:49:58 UTC
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.