summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/logic/test/compile-fail
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/logic/test/compile-fail
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/logic/test/compile-fail')
-rw-r--r--src/boost/libs/logic/test/compile-fail/implicit.cpp23
-rw-r--r--src/boost/libs/logic/test/compile-fail/implicit_int_1.cpp16
-rw-r--r--src/boost/libs/logic/test/compile-fail/implicit_int_2.cpp16
-rw-r--r--src/boost/libs/logic/test/compile-fail/implicit_int_3.cpp16
-rw-r--r--src/boost/libs/logic/test/compile-fail/operator_less_1.cpp16
-rw-r--r--src/boost/libs/logic/test/compile-fail/operator_less_2.cpp15
6 files changed, 102 insertions, 0 deletions
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 <boost/logic/tribool.hpp>
+
+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 <boost/logic/tribool.hpp>
+
+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 <boost/logic/tribool.hpp>
+
+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 <boost/logic/tribool.hpp>
+
+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 <boost/logic/tribool.hpp>
+
+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 <boost/logic/tribool.hpp>
+
+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')
+}