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}
2 files changed