Boost logo

Boost :

Subject: Re: [boost] [system] Viral C++11 change would break dependent libraries:-(
From: Beman Dawes (bdawes_at_[hidden])
Date: 2012-08-28 16:39:47


On Mon, Aug 27, 2012 at 1:33 PM, Beman Dawes <bdawes_at_[hidden]> wrote:
> Ticket #7278 asks that Boost.System add C++11 noexcept support. A
> reasonable request, and I implemented it this morning by adding
> BOOST_NOEXCEPT at the appropriate places specified in the standard.
>
> But there is a problem. noexcept is viral, so any classes that
> inherit from a class that uses noexcept must be changed to also use no
> except.
>
> An example: Boost.Filesystem has this class:
>
> class codecvt_error_cat : public boost::system::error_category
> {
> public:
> codecvt_error_cat(){}
> const char* name() const
> {return "codecvt";}
> std::string message(int ev) const;
> };
>
> Compiling with GCC 4.7 -std=c++0x results in this error:
>
> ..\..\../boost/system/error_code.hpp:187:32: error: overriding
> 'virtual const char* boost::system::error_category::name() const
> noexcept (true)'
>
> To fix it, the filesystem class has to be changed:
>
> class codecvt_error_cat : public boost::system::error_category
> {
> public:
> codecvt_error_cat(){}
> const char* name() const BOOST_NOEXCEPT
> {return "codecvt";}
> std::string message(int ev) const;
> };
>
> I've held off committing the Boost.System changes to trunk until we've
> had a chance to discuss how to approach this potential break to an
> unknown number of Boost and user libraries.

It looks like the affected Boost libraries are ASIO, Chrono,
Filesystem, Thread, and of course System.

I'll post a separate message describing a proposed [status] addition
to the BOOST_NOEXCEPT* macros.

--Beman

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk