From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/boost/libs/safe_numerics/example/example17.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/boost/libs/safe_numerics/example/example17.cpp (limited to 'src/boost/libs/safe_numerics/example/example17.cpp') diff --git a/src/boost/libs/safe_numerics/example/example17.cpp b/src/boost/libs/safe_numerics/example/example17.cpp new file mode 100644 index 00000000..372be9cc --- /dev/null +++ b/src/boost/libs/safe_numerics/example/example17.cpp @@ -0,0 +1,16 @@ +#include +using namespace boost::safe_numerics; + +int f(int i){ + return i; +} + +using safe_t = safe; + +int main(){ + const long x = 97; + f(x); // OK - implicit conversion to int + const safe_t y = 97; + f(y); // Would be OK, but will invoke compile time error + return 0; +} \ No newline at end of file -- cgit v1.2.3