diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2013-10-05 23:29:16 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2013-10-05 23:29:16 +0000 |
commit | d2f095e5bab4c2df2d94e1d0f4e7637f35a828f6 (patch) | |
tree | c9ec830ba193eae1964b1a066bcd43ab0a62dd44 /libcxx/test/utilities/optional/optional.relops/equal.pass.cpp | |
parent | 4c9b7dc92e22f58f7a621e72bb6a90d77d986ef3 (diff) | |
download | bcm5719-llvm-d2f095e5bab4c2df2d94e1d0f4e7637f35a828f6.tar.gz bcm5719-llvm-d2f095e5bab4c2df2d94e1d0f4e7637f35a828f6.zip |
Add tests making sure that optional<T>s can be compared at compile time; this functionality was enabled by N3789
llvm-svn: 192051
Diffstat (limited to 'libcxx/test/utilities/optional/optional.relops/equal.pass.cpp')
-rw-r--r-- | libcxx/test/utilities/optional/optional.relops/equal.pass.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libcxx/test/utilities/optional/optional.relops/equal.pass.cpp b/libcxx/test/utilities/optional/optional.relops/equal.pass.cpp index ec0503c39ba..a600d07ecbe 100644 --- a/libcxx/test/utilities/optional/optional.relops/equal.pass.cpp +++ b/libcxx/test/utilities/optional/optional.relops/equal.pass.cpp @@ -15,11 +15,25 @@ #include <type_traits> #include <cassert> +#if _LIBCPP_STD_VER > 11 + +struct X +{ + int i_; + + constexpr X(int i) : i_(i) {} +}; + +constexpr bool operator == ( const X &rhs, const X &lhs ) + { return rhs.i_ == lhs.i_ ; } + +#endif + int main() { #if _LIBCPP_STD_VER > 11 { - typedef int T; + typedef X T; typedef std::optional<T> O; constexpr O o1; // disengaged |