[Bug c++/48372] New: Missed error for redundant default argument on template.
jyasskin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Mar 30 19:38:00 GMT 2011
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]
$
More information about the Gcc-bugs
mailing list