[llvm-bugs] [Bug 39175] New: std::is_nothrow_constructibe doesn't work well in case of std::optional<...>
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Oct 4 08:18:46 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39175
Bug ID: 39175
Summary: std::is_nothrow_constructibe doesn't work well in case
of std::optional<...>
Product: libc++
Version: 7.0
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: mate.pek at gmail.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
Hello,
The following code fails:
>>>
#include <type_traits>
#include <optional>
struct FooThrow {
FooThrow() noexcept(true) {}
~FooThrow() noexcept(false) {} // <-- if true: OK
};
static_assert(noexcept(std::optional<FooThrow>()));
static_assert(noexcept(std::optional<FooThrow>(std::nullopt)));
static_assert(std::is_nothrow_constructible_v<std::optional<FooThrow>,
std::nullopt_t>);
static_assert(std::is_nothrow_constructible_v<std::optional<FooThrow>>);
<<<
(gcc compiles it)
I assume it is a library bug, because "noexcept(FooThrow())" is false with gcc
and clang too.
Best Regards,
Mate Pek
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181004/3635db16/attachment-0001.html>
More information about the llvm-bugs
mailing list