post_pre_error.cpp 616 B

1234567891011121314151617181920212223
  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 pre after post error (same if not free func).
  6. #include <boost/contract/function.hpp>
  7. #include <boost/contract/check.hpp>
  8. void f() {
  9. boost::contract::check c = boost::contract::function()
  10. .postcondition([] {})
  11. .precondition([] {}) // Error (pre after post).
  12. ;
  13. }
  14. int main() {
  15. f();
  16. return 0;
  17. }