Opened 12 years ago

Last modified 12 years ago

#4301 new Bugs

and_<true_>::type is false_

Reported by: mstefanro Owned by: Joel Falcou
Milestone: Boost 1.46.0 Component: mpl
Version: Boost Development Trunk Severity: Problem
Keywords: Cc: admin@…

Description

It is probably a good idea to make and_<true_>::type be true_, or throw a compiler error, or at least fix the documentation at http://www.boost.org/doc/libs/1_43_0/libs/mpl/doc/refmanual/and.html such that this unusual behavior is documented.

Change History (2)

comment:1 by Steven Watanabe, 12 years ago

Hmmm. The fact that this even compiles is an artifact of the way mpl::na is implemented. and_ is only intended to take two or more arguments.

comment:2 by Bryce Adelstein Lelbach, 12 years ago

Cc: admin@… added
Milestone: Boost 1.43.0Boost 1.46.0
Owner: changed from Aleksey Gurtovoy to Joel Falcou
Severity: CosmeticProblem
Version: Boost 1.44.0Boost Development Trunk

Confirmed, this is still a problem, possibly a problem with other binary logical operations too. I think we need to prohibit an unary and_ entirely. This reproduces the problem:

#include <boost/mpl/assert.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/and.hpp>

int main (void) {
  using boost::mpl::and_;
  using boost::mpl::true_;

  BOOST_MPL_ASSERT((and_<true_>));
}

Note: See TracTickets for help on using tickets.