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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
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
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs