[llvm-bugs] [Bug 51348] New: llvm::Optional doesn't work well with move-only types
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Aug 4 14:18:21 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51348
Bug ID: 51348
Summary: llvm::Optional doesn't work well with move-only types
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Support Libraries
Assignee: unassignedbugs at nondot.org
Reporter: lemo1234 at gmail.com
CC: llvm-bugs at lists.llvm.org
`llvm::Optional<T>` doesn't work well when T is a move-only type.
Repro: https://godbolt.org/z/adPEfaaEa
#include <llvm/ADT/Optional.h>
#include <vector>
#include <optional>
int main() {
using X = std::unique_ptr<int>;
using Y = llvm::Optional<X>; // fails to compile
//using Y = std::optional<X>; // compiles fine
std::vector<Y> z;
z.push_back(std::make_unique<int>(42));
}
The problem seems to be traced to the following?
std::_Construct(std::__addressof(*__cur), *__first);
--
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/20210804/035280ad/attachment.html>
More information about the llvm-bugs
mailing list