1 2 // Copyright (C) 2008-2018 Lorenzo Caminiti 3 // Distributed under the Boost Software License, Version 1.0 (see accompanying 4 // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). 5 // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html 6 7 // Test auto error after old (for free func, but same for all contracts). 8 9 #include <boost/config.hpp> 10 // Not just __cplusplus to detect C++17 as MSVC defines it correctly sometimes. 11 #if (defined(__cplusplus) && __cplusplus >= 201703L) || \ 12 !defined(BOOST_NO_CXX17_IF_CONSTEXPR) 13 #error "C++17 copy elision invalidates test so forcing expected failure" 14 #else 15 16 #include <boost/contract/function.hpp> 17 main()18int main() { 19 auto c = boost::contract::function() // Error (can't use auto). 20 .precondition([] {}) 21 .old([] {}) 22 ; 23 return 0; 24 } 25 26 #endif 27 28