This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/5685: g++ 3.0.2 allows multiple identical declaration of default argument
- From: Rick Hu <rhu at tk dot eq dot gs dot com>
- To: gcc-gnats at gcc dot gnu dot org
- Date: Thu, 14 Feb 2002 18:57:27 +0900 (JST)
- Subject: c++/5685: g++ 3.0.2 allows multiple identical declaration of default argument
>Number: 5685
>Category: c++
>Synopsis: g++ 3.0.2 allows multiple identical declaration of default argument
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Thu Feb 14 02:06:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Rick Hu
>Release: 3.0.2
>Organization:
Goldman Sachs
>Environment:
System: SunOS ninjin 5.6 Generic_105181-23 sun4u sparc SUNW,Ultra-80
Architecture: sun4
host: sparc-sun-solaris2.6
build: sparc-sun-solaris2.6
target: sparc-sun-solaris2.6
configured with: ../gcc-3.0.2/configure --prefix=/home/rhu/local/local/gcc-3.0.2 --enable-languages=c,c++
>Description:
ISO C++ Standard clause 8.3.6 Default arguments says:
A default argument shall not be redefined by a later declaration (not even to the same value).
The g++ compiler allows a later declaration to the same value.
>How-To-Repeat:
SOURCE CODE "foo.cc"
#include <iostream>
void foo(int, int = 0);
void foo(int, int = 0);
void foo(int a, int b)
{
std::cout << a << std::endl;
std::cout << b << std::endl;
}
main()
{
foo(1, 2);
foo(3);
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: