diff options
Diffstat (limited to 'libcxx/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp')
-rw-r--r-- | libcxx/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libcxx/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp b/libcxx/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp index 851157f960f..4ed0c92e026 100644 --- a/libcxx/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp +++ b/libcxx/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp @@ -74,6 +74,17 @@ public: friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;} }; + +class ConstMovable +{ + int i_; +public: + ConstMovable(int i) : i_(i) {} + ConstMovable(const ConstMovable&& x) : i_(x.i_) {} + ~ConstMovable() {i_ = 0;} + friend bool operator==(const ConstMovable& x, const ConstMovable& y) {return x.i_ == y.i_;} +}; + int main() { { @@ -87,6 +98,11 @@ int main() test(rhs); } { + typedef const int T; + optional<T> rhs(3); + test(rhs); + } + { typedef X T; optional<T> rhs; test(rhs); @@ -97,6 +113,11 @@ int main() test(rhs); } { + typedef const ConstMovable T; + optional<T> rhs(ConstMovable(3)); + test(rhs); + } + { typedef Y T; optional<T> rhs; test(rhs); |