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 --- .../libs/logic/test/compile-fail/implicit.cpp | 23 ++++++++++++++++++++++ .../logic/test/compile-fail/implicit_int_1.cpp | 16 +++++++++++++++ .../logic/test/compile-fail/implicit_int_2.cpp | 16 +++++++++++++++ .../logic/test/compile-fail/implicit_int_3.cpp | 16 +++++++++++++++ .../logic/test/compile-fail/operator_less_1.cpp | 16 +++++++++++++++ .../logic/test/compile-fail/operator_less_2.cpp | 15 ++++++++++++++ 6 files changed, 102 insertions(+) create mode 100644 src/boost/libs/logic/test/compile-fail/implicit.cpp create mode 100644 src/boost/libs/logic/test/compile-fail/implicit_int_1.cpp create mode 100644 src/boost/libs/logic/test/compile-fail/implicit_int_2.cpp create mode 100644 src/boost/libs/logic/test/compile-fail/implicit_int_3.cpp create mode 100644 src/boost/libs/logic/test/compile-fail/operator_less_1.cpp create mode 100644 src/boost/libs/logic/test/compile-fail/operator_less_2.cpp (limited to 'src/boost/libs/logic/test/compile-fail') diff --git a/src/boost/libs/logic/test/compile-fail/implicit.cpp b/src/boost/libs/logic/test/compile-fail/implicit.cpp new file mode 100644 index 00000000..ba56bfb8 --- /dev/null +++ b/src/boost/libs/logic/test/compile-fail/implicit.cpp @@ -0,0 +1,23 @@ +// Copyright 2018 James E. King III. Use, modification and +// distribution is subject to 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) + +#include + +int main(int, char*[]) +{ + using boost::logic::indeterminate; + using boost::logic::tribool; + + tribool i(indeterminate); + +#if !defined( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS ) + bool b = i; // expect to see: no viable conversion from 'boost::logic::tribool' to 'bool' + return (int)b; +#else +#error in c++03 explicit conversions are allowed +#endif + // NOTREACHED + return 0; +} diff --git a/src/boost/libs/logic/test/compile-fail/implicit_int_1.cpp b/src/boost/libs/logic/test/compile-fail/implicit_int_1.cpp new file mode 100644 index 00000000..4e889550 --- /dev/null +++ b/src/boost/libs/logic/test/compile-fail/implicit_int_1.cpp @@ -0,0 +1,16 @@ +// Copyright 2018 James E. King III. Use, modification and +// distribution is subject to 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) + +#include + +int main(int, char*[]) +{ + using boost::logic::indeterminate; + using boost::logic::tribool; + + tribool i(indeterminate); + + return i; // expect to see: error: no viable conversion from returned value of type 'boost::logic::tribool' to function return type 'int' +} diff --git a/src/boost/libs/logic/test/compile-fail/implicit_int_2.cpp b/src/boost/libs/logic/test/compile-fail/implicit_int_2.cpp new file mode 100644 index 00000000..1401caaa --- /dev/null +++ b/src/boost/libs/logic/test/compile-fail/implicit_int_2.cpp @@ -0,0 +1,16 @@ +// Copyright 2018 James E. King III. Use, modification and +// distribution is subject to 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) + +#include + +int main(int, char*[]) +{ + using boost::logic::indeterminate; + using boost::logic::tribool; + + tribool i(indeterminate); + + return i + 1; // expect to see: error: invalid operands to binary expression ('boost::logic::tribool' and 'int') +} diff --git a/src/boost/libs/logic/test/compile-fail/implicit_int_3.cpp b/src/boost/libs/logic/test/compile-fail/implicit_int_3.cpp new file mode 100644 index 00000000..b6548c5a --- /dev/null +++ b/src/boost/libs/logic/test/compile-fail/implicit_int_3.cpp @@ -0,0 +1,16 @@ +// Copyright 2018 James E. King III. Use, modification and +// distribution is subject to 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) + +#include + +int main(int, char*[]) +{ + using boost::logic::indeterminate; + using boost::logic::tribool; + + tribool i(indeterminate); + + return i << 1; // expect to see: error: invalid operands to binary expression ('boost::logic::tribool' and 'int') +} diff --git a/src/boost/libs/logic/test/compile-fail/operator_less_1.cpp b/src/boost/libs/logic/test/compile-fail/operator_less_1.cpp new file mode 100644 index 00000000..31be7aee --- /dev/null +++ b/src/boost/libs/logic/test/compile-fail/operator_less_1.cpp @@ -0,0 +1,16 @@ +// Copyright 2018 James E. King III. Use, modification and +// distribution is subject to 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) + +#include + +int main(int, char*[]) +{ + using boost::logic::tribool; + + tribool f; // false + tribool t(true); // true + + return f < t; // expect to see: error: invalid operands to binary expression ('boost::logic::tribool' and 'boost::logic::tribool') +} diff --git a/src/boost/libs/logic/test/compile-fail/operator_less_2.cpp b/src/boost/libs/logic/test/compile-fail/operator_less_2.cpp new file mode 100644 index 00000000..53fc359a --- /dev/null +++ b/src/boost/libs/logic/test/compile-fail/operator_less_2.cpp @@ -0,0 +1,15 @@ +// Copyright 2018 James E. King III. Use, modification and +// distribution is subject to 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) + +#include + +int main(int, char*[]) +{ + using boost::logic::tribool; + + tribool t(true); + + return t < 1; // expect to see: error: invalid operands to binary expression ('boost::logic::tribool' and 'int') +} -- cgit v1.2.3