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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

`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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to