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 override func does not actually override (unless PERMISSIVE). 10 11 #include <boost/contract/public_function.hpp> 12 #include <boost/contract/base_types.hpp> 13 #include <boost/contract/override.hpp> 14 #include <boost/contract/check.hpp> 15 16 struct b { gb17 virtual void g(boost::contract::virtual_* v = 0) { 18 boost::contract::check c = boost::contract::public_function(v, this); 19 } 20 }; 21 22 struct a 23 #define BASES public b 24 : BASES 25 { 26 typedef BOOST_CONTRACT_BASE_TYPES(BASES) base_types; 27 #undef BASES 28 fa29 virtual void f(boost::contract::virtual_* v = 0) /* override */ { 30 boost::contract::check c = boost::contract::public_function< 31 override_f>(v, &a::f, this); 32 } 33 BOOST_CONTRACT_OVERRIDE(f) 34 }; 35 main()36int main() { 37 a aa; 38 aa.f(); 39 return 0; 40 } 41 42