]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/optional/test/optional_test_convert_from_T.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / optional / test / optional_test_convert_from_T.cpp
index d4ce4bb3e8b3843c1c58d14cddbec41f0afcf42e..6d4c2ffd0fddc08d06a74a59f3eaa04ccefe60aa 100644 (file)
 using boost::optional;
 using boost::none;
 
+template <typename U>
+struct superconv
+{
+  #ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
+  template <typename T>
+    superconv(T&&) { BOOST_STATIC_ASSERT(sizeof(T) == 0); }
+  #else
+  template <typename T>
+    superconv(const T&) { BOOST_STATIC_ASSERT(sizeof(T) == 0); }
+  template <typename T>
+    superconv(      T&) { BOOST_STATIC_ASSERT(sizeof(T) == 0); }
+  #endif
+  
+  superconv() {}
+};
+
+void test_optional_of_superconverting_T() // compile-time test
+{
+#ifndef BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT
+  superconv<optional<int> > s;
+   superconv<optional<int> > & rs = s;
+  optional<superconv<optional<int> > > os = rs;
+#endif
+}
+
 void test_optional_optional_T()
 {
   optional<int> oi1 (1), oiN;
@@ -39,6 +64,7 @@ void test_optional_optional_T()
 int main()
 {
     test_optional_optional_T();
-  
+    test_optional_of_superconverting_T();
+    
     return boost::report_errors();
 }