summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/logic/test/compile-fail
diff options
context:
space:
mode:
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 000000000..ba56bfb86
--- /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 000000000..4e889550c
--- /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 000000000..1401caaa7
--- /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 000000000..b6548c5a8
--- /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 000000000..31be7aeef
--- /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 000000000..53fc359a8
--- /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')
+}