This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/50871] New: [C++0x] G++ fails to reject explicitly-defaulted function definition with different exception spec
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 25 Oct 2011 22:28:50 +0000
- Subject: [Bug c++/50871] New: [C++0x] G++ fails to reject explicitly-defaulted function definition with different exception spec
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50871
Bug #: 50871
Summary: [C++0x] G++ fails to reject explicitly-defaulted
function definition with different exception spec
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: redi@gcc.gnu.org
Preprocessed source, note first line:
# 1 "/" 3
class condvar
{
public:
condvar() noexcept;
~condvar() noexcept;
};
condvar::condvar() = default;
condvar::~condvar() = default;
This should be rejected because the explicitily-defaulted definitions are
missing "noexcept" but it compiles without error:
$ g++ -std=gnu++0x cv.ii -c
$
If the first line is removed it is rejected:
cv.ii:11:18: error: declaration of âcondvar::condvar()â has a different
exception specifier
cv.ii:6:3: error: from previous declaration âcondvar::condvar() noexcept
(true)â
cv.ii:12:19: error: declaration of âcondvar::~condvar()â has a different
exception specifier
cv.ii:7:3: error: from previous declaration âcondvar::~condvar() noexcept
(true)â