Opened 9 years ago

Closed 7 years ago

#8679 closed Bugs (fixed)

Boost.Test pollutes boost namespace with it's own enable_if/disable_if templates

Reported by: John Maddock Owned by: Gennadiy Rozental
Milestone: Boost 1.59.0 Component: test
Version: Boost Development Trunk Severity: Showstopper
Keywords: Cc:

Description

The following test program:

#define BOOST_TEST_MODULE my_test

#include <boost/multiprecision/cpp_dec_float.hpp>

#define BOOST_TEST_MAIN
#include <boost/test/included/unit_test.hpp> // Note: header-only Boost.Test
#include <boost/test/floating_point_comparison.hpp>

BOOST_AUTO_TEST_CASE(my_test)
{
  typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<50>,
                                        boost::multiprecision::et_off> mp_type;

  const mp_type test_value = mp_type(12) / 7;
}

Fails to compile due to ambiguities between boost::enable_if and boost::unit_test::decorator::disable_if:

1>d:\data\boost\trunk\boost\multiprecision\number.hpp(118): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>          d:\data\boost\trunk\boost\type_traits\is_convertible.hpp(484) : see reference to class template instantiation 'boost::multiprecision::number<Backend>' being compiled
1>          with
1>          [
1>              Backend=boost::multiprecision::backends::cpp_dec_float<50>
1>          ]
1>          d:\data\boost\trunk\boost\multiprecision\detail\no_et_ops.hpp(455) : see reference to class template instantiation 'boost::is_convertible<From,To>' being compiled
1>          with
1>          [
1>              From=__int64,
1>              To=boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<50>>
1>          ]
1>          d:\data\boost\trunk\ide\math\scrap\scrap.cpp(38) : see reference to function template instantiation 'boost::multiprecision::number<Backend,ExpressionTemplates> boost::multiprecision::operator /<boost::multiprecision::backends::cpp_dec_float<Digits10>,int>(boost::multiprecision::number<Backend,ExpressionTemplates> &&,const V &)' being compiled
1>          with
1>          [
1>              Backend=boost::multiprecision::backends::cpp_dec_float<50>,
1>              ExpressionTemplates=et_off,
1>              Digits10=50,
1>              V=int
1>          ]
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(118): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(118): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(118): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(124): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(124): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(124): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(124): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(131): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(131): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(153): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(153): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(168): error C2872: 'disable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(59) : boost::disable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(197) : boost::unit_test::decorator::disable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(168): error C2872: 'disable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(59) : boost::disable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(197) : boost::unit_test::decorator::disable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(237): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(237): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(268): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(268): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(312): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(312): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(343): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(343): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(391): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(391): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(400): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(400): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(431): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(431): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(465): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(465): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(500): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(500): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(533): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(533): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(661): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(661): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(1637): error C2872: 'disable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(59) : boost::disable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(197) : boost::unit_test::decorator::disable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(1637): error C2872: 'disable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(59) : boost::disable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(197) : boost::unit_test::decorator::disable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(1640): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'
1>d:\data\boost\trunk\boost\multiprecision\number.hpp(1640): error C2872: 'enable_if' : ambiguous symbol
1>          could be 'd:\data\boost\trunk\boost\utility\enable_if.hpp(36) : boost::enable_if'
1>          or       'd:\data\boost\trunk\boost\test\tree\decorator.hpp(184) : boost::unit_test::decorator::enable_if'

IMO Boost.Test should not pollute namespace boost with types of the same name as other types already there.

Change History (3)

comment:1 by Gennadiy Rozental, 9 years ago

Your example letter for letter builds fine with gcc 4.7.2 and VS 10 on my windows box

comment:2 by Raffi Enficiaud, 7 years ago

I believe this is fixed now in master. Can anyone confirm?

comment:3 by Gennadiy Rozental, 7 years ago

Milestone: To Be DeterminedBoost 1.59.0
Resolution: fixed
Status: newclosed

I believe this is resolved in 1.59

Note: See TracTickets for help on using tickets.