Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / contract / test / invariant / static_volatile.hpp
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 static inv declared volatile (unless PERMISSIVE #defined).
10
11 #include <boost/contract/public_function.hpp>
12 #include <boost/contract/check.hpp>
13
14 struct a {
15     void static_invariant() volatile {}
16
17     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
23 int main() {
24     a aa;
25     aa.f();
26     return 0;
27 }
28