title: c++ boost tribool ternary operator wrong value
body: <p>Boost 1.55, MSVC express 2012.
  Wrong expression evaluation with tribool.
  It works correct only when I specify tribool(false) explicitly.</p>
  
  <p><strong>Moral of the story</strong>: compiler chooses TYPES based on VALUES.</p>
  
  <pre><code>auto a = 0? indeterminate : false; // type function pointer
  auto b = 0? indeterminate : true; // type bool
  </code></pre>
  
  <p>Output:</p>
  
  <ol>
  <li>indet   : 1? indeterminate : false</li>
  <li>indet   : 0? indeterminate : false</li>
  <li>true    : 1? indeterminate : true</li>
  <li>true    : 0? indeterminate : true</li>
  <li>indet   : 1? indeterminate : tribool(false)</li>
  <li>false   : 0? indeterminate : tribool(false)</li>
  <li>indet   : 1? indeterminate : tribool(true)</li>
  <li>true    : 0? indeterminate : tribool(true)</li>
  </ol>
  
  <p>Source code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;boost/logic/tribool.hpp&gt;
  
  using namespace boost;
  
  void test_tribool( const tribool&amp; v, const char* name )
  {
      const char* s;
      if ( v )
          s = "true";
      else if ( !v )
          s = "false";
      else
          s = "indet";
      std::cout &lt;&lt; s &lt;&lt; "\t: " &lt;&lt; name &lt;&lt; std::endl;
  }
  
  #define TEST_TRIBOOL( ... ) test_tribool( (__VA_ARGS__), #__VA_ARGS__ );
  
  int main(int argc, char** argv)
  {
      TEST_TRIBOOL( 1? indeterminate : false );
      TEST_TRIBOOL( 0? indeterminate : false );
  
      // warning C4305: ':' : truncation from 'bool (__cdecl *)(boost::logic::tribool,boost::logic::detail::indeterminate_t)' to 'bool'
      TEST_TRIBOOL( 1? indeterminate : true );
  
      // warning C4305: ':' : truncation from 'bool (__cdecl *)(boost::logic::tribool,boost::logic::detail::indeterminate_t)' to 'bool'
      TEST_TRIBOOL( 0? indeterminate : true );
  
  
      TEST_TRIBOOL( 1? indeterminate : tribool(false) );
      TEST_TRIBOOL( 0? indeterminate : tribool(false) );
      TEST_TRIBOOL( 1? indeterminate : tribool(true) );
      TEST_TRIBOOL( 0? indeterminate : tribool(true) );
  
      return 0;
  }
  </code></pre>