Boost C++ Libraries: Ticket #339: Tribool: strange results on I/O https://svn.boost.org/trac10/ticket/339 <pre class="wiki">Please look at the code below: #include &lt;iostream&gt; #include &lt;boost/logic/tribool.hpp&gt; using namespace std; using namespace boost::logic; #define PRINTEXP( exp ) print_exp( #exp, exp ) inline void print_exp( const char* name, tribool expr ) { cout &lt;&lt; name &lt;&lt; ": " &lt;&lt; boolalpha &lt;&lt; expr &lt;&lt; endl; } int main( int argc, char** argv ) { cout &lt;&lt; true &lt;&lt; endl; cout &lt;&lt; false &lt;&lt; endl; cout &lt;&lt; indeterminate &lt;&lt; endl; const tribool yes = true; const tribool no = false; const tribool maybe = indeterminate; PRINTEXP( yes ); PRINTEXP( no ); PRINTEXP( maybe ); return 0; } According to the documentation, the result should be: 1 0 2 yes: true no: false maybe: indeterminate However the result is: 1 0 1 yes: true no: false maybe: false Of course, there is a warning when compiling: lite-3bool.cc:20: warning: the address of `bool boost::logic::indeterminate(boost::logic::tribool, boost::logic::detail::indeterminate_t)', will always be `true' which excuses the "1" for indeterminate, however also proves that no `ostream&amp; &lt;&lt; tribool' is defined (or it's somehow not seen). &gt; uname -a CYGWIN_NT-5.1 hostname 1.5.12(0.116/4/2) 2004-11- 10 08:34 i686 unknown unknown Cygwin &gt; g++ -v ... Thread model: posix gcc version 3.3.3 (cygwin special) </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/339 Trac 1.4.3 Douglas Gregor Fri, 18 Mar 2005 20:42:22 GMT status changed https://svn.boost.org/trac10/ticket/339#comment:1 https://svn.boost.org/trac10/ticket/339#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=249098 There are two issues here, one in the example program and one in the Tribool code. 1) The warning is telling is that it really is converting the address of "indeterminate" (which is a function, not actually a "tribool") to a boolean value, then using the ostream &lt;&lt; overload for bool. This is a bug in Tribool which I've just fixed. 2) The "maybe: false" is actually a bug in the sample program, which does not #include &lt;boost/logic/tribool_io.hpp&gt; and therefore doesn't actually get any of the tribool I/O operations. </pre> Ticket