https://llvm.org/bugs/show_bug.cgi?id=30260
Bug ID: 30260 Summary: optional<const T> not working Product: libc++ Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: P Component: All Bugs Assignee: unassignedclangb...@nondot.org Reporter: howard.hinn...@gmail.com CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com Classification: Unclassified I expect this to compile and work: #include <experimental/optional> struct Foo {}; std::experimental::optional<const Foo> someFunc(); int main() { std::experimental::optional<const Foo> j; j.emplace(*someFunc()); } Instead I get compile-time errors such as: In file included from test.cpp:22: ../libcxx/include/experimental/optional:274:17: error: no matching function for call to 'operator new' ::new(_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_)); ^~ I believe all that is needed (untested suggestion) is a const_cast of the result of addressof on the way to new (several places). -- 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