|
Boost : |
Subject: Re: [boost] noexcept(true) for ~noncopyable?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2014-11-18 11:13:53
On Tue, Nov 18, 2014 at 7:00 PM, Olaf van der Spek <ml_at_[hidden]> wrote:
> On Tue, Nov 18, 2014 at 4:59 PM, Andrey Semashev
> <andrey.semashev_at_[hidden]> wrote:
>> On Tue, Nov 18, 2014 at 6:56 PM, Olaf van der Spek <ml_at_[hidden]> wrote:
>>> Shouldn't ~noncopyable be noexcept?
>>>
>>> I'm seeing this error:
>>>
>>> class Cconnection : public Cclient, boost::noncopyable
>>>
>>> connection.h:5:7: error: looser throw specifier for âvirtual
>>> Cconnection::~Cconnection()â
>>> In file included from connection.h:3:0,
>>> from connection.cpp:2:
>>> client.h:10:10: error: overriding âvirtual Cclient::~Cclient()
>>> noexcept (true)â
>>>
>>> https://svn.boost.org/trac/boost/ticket/10698
>>
>> Destructors are implicitly noexcept.
>
> So it's a compiler bug?
>From what I can see from the error message, the compiler complains
about Cconnection::~Cconnection(), where Cconnection presumably
derives from Cclient. Cclient::~Cclient() is noexcept while
Cconnection::~Cconnection() is not. If Cconnection::~Cconnection()
does not have non-empty exception specification or noexcept(false), it
should be implicitly noexcept and the compiler is wrong here. This
goes for compiler-generated Cconnection::~Cconnection() as well,
unless some member has a throwing destructor.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk