no_make_old_error.hpp 682 B

123456789101112131415161718192021
  1. // Copyright (C) 2008-2018 Lorenzo Caminiti
  2. // Distributed under the Boost Software License, Version 1.0 (see accompanying
  3. // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
  4. // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
  5. // Test error when make_old(...) not used by mistake.
  6. #ifndef BOOST_CONTRACT_TEST_OLD_PTR_TYPE
  7. #error "must define BOOST_CONTRACT_TEST_OLD_PTR_TYPE"
  8. #endif
  9. #include <boost/contract/old.hpp>
  10. int main() {
  11. int x = 1;
  12. BOOST_CONTRACT_TEST_OLD_PTR_TYPE<int> old_x = boost::contract::copy_old() ?
  13. x : boost::contract::null_old(); // Error (missing make_old(...)).
  14. return 0;
  15. }