Re: Supporting C++17



On 4 April 2017 at 22:56, Chris Vine wrote:
I would check that.  It didn't affect ABI in C++11/14, but I am not so
sure about C++17.  According to
http://en.cppreference.com/w/cpp/language/noexcept_spec,
in C++17 "The noexcept-specification is a part of the function type and
may appear as part of any function declarator."  If it is part of the
type then it might feature in name mangling, so this is worth checking
with the compiler writers.

In C++17 the exception spec is part of the type, so noexcept(true)
functions are mangled differently from functions that are
noexcept(false).

But functions with dynamic exception specification aren't
noexcept(true), so they're not mangled as noexcept(true) functions
would be.

If you replace the throw(std::bad_cast) with neoxcept(false) (or,
equivalently, omit the exception specification entirely) they still
aren't noexcept(true).

Here's the proof:
https://paste.fedoraproject.org/paste/Pwm-rv4LGXKh2EDVJSeOEl5M1UNdIGYhyRLivL9gydE=/

N.B. I didn't say that exception specifications don't affect the type,
I said that removing the deprecated dynamic exception specification,
i.e. throw(std::bad_cast), doesn't affect the type. Because it's still
a noexcept(false) function.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]