commit | 65eb2ba3425e18bb3b101299f11358786e0dacae | [log] [tgz] |
---|---|---|
author | Fyodor Gayokho <[email protected]> | Thu Mar 22 18:09:21 2018 |
committer | Commit Bot <[email protected]> | Thu Mar 22 18:09:21 2018 |
tree | e920d870dd99cf9ecb946860ba2004bf336dd2ce | |
parent | d927492b95bcfae183359241e02a39c3afd7a941 [diff] |
Fix move constructors' noexcept propagation By spec, if a member (OptionalStorage) has potentially-throwing move constructor (when T is not trivially move constructible), the implicit move constructor is also potentially-throwing (OptionalBase and Optional). However, if T is nothrow move constructible, noexcept is explicitly specified to the Optional's move constructor. This hits the following statement in the spec (11.4.2 [dcl.fct.def.default]) If a function that is explicitly defaulted has an explicit exception-specification that is not compatible (18.4 [except.spec]) with the exception-specification on the implicit declaration, then - if the function is explicitly defaulted on its first declaration, it is defined as deleted; So, move constructor would be deleted. Note that, practically, with -fno-exceptions as we build Chrome, clang outputs is_nothrow_move_constructible<Optional<T>>::value will be false, although move ctor itself looks generated. This is the fix for that case. Also note that, without -fno-exceptions, clang would report "error: exception specification of explicitly defaulted move constructor does not match the calculated one". This is a clang bug (https://bugs.llvm.org/show_bug.cgi?id=22325). Change-Id: I7c5775084e2c75157b337c97b04a84e9d2879e11 Reviewed-on: https://chromium-review.googlesource.com/964961 Reviewed-by: danakj <[email protected]> Reviewed-by: Hidehiko Abe <[email protected]> Commit-Queue: danakj <[email protected]> Cr-Commit-Position: refs/heads/master@{#545156}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .