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] $
Confirmed.
Isn't this a DUP of Bug 15339?
Yes it is, IMO. *** This bug has been marked as a duplicate of bug 15339 ***