This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/48372] New: Missed error for redundant default argument on template.
- From: "jyasskin at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 30 Mar 2011 18:47:07 +0000
- Subject: [Bug c++/48372] New: Missed error for redundant default argument on template.
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48372
Summary: Missed error for redundant default argument on
template.
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jyasskin@gcc.gnu.org
Using a trunk gcc:
$ cat test.cc
template<typename _Ex>
void
__throw_with_nested(const _Ex&, const int* = 0)
__attribute__ ((__noreturn__));
template<typename _Ex>
inline void
__throw_with_nested(const _Ex& __ex, const int* = 0)
{ throw __ex; }
void foo() {
__throw_with_nested(3);
}
$ g++ -c test.cc
$
However, if I make them non-templates:
$ cat test.cc
void
__throw_with_nested(const int&, const int* = 0)
__attribute__ ((__noreturn__));
inline void
__throw_with_nested(const int& __ex, const int* = 0)
{ throw __ex; }
void foo() {
__throw_with_nested(3);
}
$ g++ -c test.cc
test.cc: In function âvoid __throw_with_nested(const int&, const int*)â:
test.cc:6:52: error: default argument given for parameter 2 of âvoid
__throw_with_nested(const int&, const int*)â [-fpermissive]
test.cc:2:1: error: after previous specification in âvoid
__throw_with_nested(const int&, const int*)â [-fpermissive]
$