This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]