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: unassig...@gcc.gnu.org ReportedBy: jyass...@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] $