Fix PR30260 - optional<const T> not working.
This patch fixes PR30260 by using a (void*) cast on the placement argument to placement new to casts away the const. See also http://llvm.org/PR30260. As a drive by change this patch also changes the header guard for <experimental/optional> to _LIBCPP_EXPERIMENTAL_OPTIONAL from _LIBCPP_OPTIONAL. llvm-svn: 280775
This commit is contained in:
@@ -87,6 +87,11 @@ int main()
|
||||
optional<T> rhs(3);
|
||||
test(rhs);
|
||||
}
|
||||
{
|
||||
typedef const int T;
|
||||
optional<T> rhs(3);
|
||||
test(rhs);
|
||||
}
|
||||
{
|
||||
typedef X T;
|
||||
optional<T> rhs;
|
||||
@@ -97,6 +102,11 @@ int main()
|
||||
optional<T> rhs(X(3));
|
||||
test(rhs);
|
||||
}
|
||||
{
|
||||
typedef const X T;
|
||||
optional<T> rhs(X(3));
|
||||
test(rhs);
|
||||
}
|
||||
{
|
||||
typedef Y T;
|
||||
optional<T> rhs;
|
||||
|
||||
Reference in New Issue
Block a user