// Copyright (c) 2012 Robert Ramey // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // testing trap // this is a compile only test - but since many build systems // can't handle a compile-only test - make sure it passes trivially. #include #include using namespace boost::safe_numerics; template // T is char, int, etc data type using safe_t = safe< T, native, loose_trap_policy // use for compiling and running tests >; template void test(){ safe_t t; safe_t u; t + u; t - u; t * u; t / u; // could fail regardless of data type t % u; // could fail regardless of data type t << u; t >> u; t | u; t & u; t ^ u; } int main(int, char *[]){ test(); // should compile test(); // should compile test(); // should fail to compile test(); // should fail to compile return 0; }