Bug 17786 - Duplicate parameter names not diagnosed in declarations.
Summary: Duplicate parameter names not diagnosed in declarations.
Status: RESOLVED DUPLICATE of bug 13717
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2004-10-01 22:50 UTC by Richard Henderson
Modified: 2004-10-03 19:52 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-10-02 12:23:16


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Henderson 2004-10-01 22:50:35 UTC
struct S { int sum(int x, int x); };

By my reading of [dcl.fct]/8, "... since it goes out of scope at the end of the
function declarator ..." implies that we *should* be treating this as a proper
scope and not ignoring the duplicate decl.

DannyB sez icpc agrees and issues a hard error.

Not a regression; fails as far back as 2.95.
Comment 1 Daniel Berlin 2004-10-01 22:53:11 UTC
dberlin@linux:~> icpc cpp.cpp
cpp.cpp(3): error: duplicate parameter name
        int sum(int x, int x);
                           ^

compilation aborted for cpp.cpp (code 2)
dberlin@linux:~> icpc -V
Intel(R) C++ Compiler for 32-bit applications, Version 8.1 ...


I haven't tried earlier versions of Intel C++, but Comeau's online tester gives
the same results for all the versions they have online.
Comment 2 Nathan Sidwell 2004-10-02 12:23:13 UTC
correct. there is a related bug in that we fail to compile things like

void foo (int x, int ary[sizeof(x)]);

Comment 3 Andrew Pinski 2004-10-03 19:52:50 UTC
And there is already a dup of this bug, PR 13717.

*** This bug has been marked as a duplicate of 13717 ***