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: unassignedclangb...@nondot.org
          Reporter: mate....@gmail.com
                CC: llvm-bugs@lists.llvm.org, mclow.li...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to