Bug 48372 - Missed error for redundant default argument on template.
Summary: Missed error for redundant default argument on template.
Status: RESOLVED DUPLICATE of bug 15339
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2011-03-30 18:46 UTC by Jeffrey Yasskin
Modified: 2011-10-12 16:11 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-03-31 09:46:46


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeffrey Yasskin 2011-03-30 18:46:54 UTC
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]
$
Comment 1 Richard Biener 2011-03-31 09:46:46 UTC
Confirmed.
Comment 2 Daniel Krügler 2011-09-12 21:34:55 UTC
Isn't this a DUP of Bug 15339?
Comment 3 Paolo Carlini 2011-10-12 16:11:22 UTC
Yes it is, IMO.

*** This bug has been marked as a duplicate of bug 15339 ***