1 2 // no #include guard 3 4 // Copyright (C) 2008-2018 Lorenzo Caminiti 5 // Distributed under the Boost Software License, Version 1.0 (see accompanying 6 // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). 7 // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html 8 9 // Test error if non-static inv declared mutable (unless PERMISSIVE #defined). 10 11 #include <boost/contract/public_function.hpp> 12 #include <boost/contract/check.hpp> 13 14 struct a { invarianta15 void invariant() {} 16 fa17 void f() { 18 // Same for ctor and dtor (because they all use check_pre_post_inv). 19 boost::contract::check c = boost::contract::public_function(this); 20 } 21 }; 22 main()23int main() { 24 a aa; 25 aa.f(); 26 return 0; 27 } 28 29