[Boost-bugs] [Boost C++ Libraries] #6331: [Boost.Test] g++ compilation error due to ambiguity between template<class Cond, class T> struct boost::enable_if and class boost::unit_test::decorator::enable_if as well as the disable_if counterparts introduced after Boost 1.48.0 (up to at least svn rev. 76217)

Subject: [Boost-bugs] [Boost C++ Libraries] #6331: [Boost.Test] g++ compilation error due to ambiguity between template<class Cond, class T> struct boost::enable_if and class boost::unit_test::decorator::enable_if as well as the disable_if counterparts introduced after Boost 1.48.0 (up to at least svn rev. 76217)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-12-29 13:36:05


#6331: [Boost.Test] g++ compilation error due to ambiguity between template<class
Cond, class T> struct boost::enable_if and class
boost::unit_test::decorator::enable_if as well as the disable_if
counterparts introduced after Boost 1.48.0 (up to at least svn rev. 76217)
-------------------------------------+--------------------------------------
 Reporter: t0rt1e@… | Owner: rogeeff
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: test
  Version: Boost Development Trunk | Severity: Problem
 Keywords: enable_if |
-------------------------------------+--------------------------------------
 The attached test case exposes a compilation problem with g++ (not
 clang++) against Boost trunk svn rev. <=76217 (after 1.48.0 release) due
 to an ambiguity between [[[template<class Cond, class T> struct
 boost::enable_if}}} and {{{class boost::unit_test::decorator::enable_if}}}
 in {{{boost/typeof/native.hpp}}}, as well as the disable_if counterparts.

 The test case compiles correctly against Boost 1.48.0 using Apple g++
 4.2.1, MacPorts g++ 4.5.3 and 4.6.2 as well as Apple clang++ 3.0 on Mac OS
 X Lion 10.7.2 and Xcode 4.2.1. It fails to compile against Boost trunk
 until at least svn rev. 76217 using any of the mentioned g++ versions.
 Surprisingly, clang++ 3.0 is still able to correctly compile the test
 case.

 The test case is derived from test_signed_integer_output_with_karma.cpp in
 Trac ticket #6126. During the
 [http://sourceforge.net/mailarchive/forum.php?thread_name=CAGCnmH11u2%2Bvfef9v8YpPnbv1cN%3Da5Px2xSu%3DKTnaKBve2vTwQ%40mail.gmail.com&forum_name
 =spirit-general discussion] of ticket #6126 on the Boost-Spirit-general
 mailing list, Jeroen Habraken identified the header
 {{{boost/test/tree/decorator.hpp}}} as the origin for the compilation
 failure of the test case against Boost trunk. He found the cause to be an
 ambiguity:

 {{{
 $ g++-mp-4.6 -o test_boost_test_decorator_enable_if
 test_boost_test_decorator_enable_if.cpp -I.../boost-trunk
 In file included from test_boost_test_decorator_enable_if.cpp:58:0:
 boost/typeof/native.hpp:30:18: error: expected nested-name-specifier
 before 'enable_if'
 boost/typeof/native.hpp:30:27: error: expected initializer before '<'
 token
 boost/typeof/native.hpp:34:18: error: expected nested-name-specifier
 before 'disable_if'
 boost/typeof/native.hpp:34:28: error: expected initializer before '<'
 token
 }}}

 These occur because the code states "{{{typename enable_if<Cond,
 T>::type}}}" and the {{{type name}}} doesn't make sense in combination
 with
 {{{boost::unit_test::decorator::enable_if}}}. When removing the
 {{{typename}}}, on gets the following
 ambiguity error:
 {{{
 boost/typeof/native.hpp:30:9: error: reference to 'enable_if' is ambiguous
 boost/utility/enable_if.hpp:36:10: error: candidates are: template<class
 Cond, class T> struct boost::enable_if
 boost/test/tree/decorator.hpp:184:23: error: class
 boost::unit_test::decorator::enable_if
 }}}
 showing the conflict between {{{template<class Cond, class T> struct
 boost::enable_if}}} and {{{class
 boost::unit_test::decorator::enable_if}}}.

 As {{{enable_if}}} is often used without being fully qualified this breaks
 in a major fashion. Since {{{boost/test/tree/decorator.hpp}}} seems to be
 quite new (added 2011-10-02 11:00:16 +0200) it might be best fixed there.

 My search on trac for {{{boost::unit_test::decorator_enable_if}}} turned
 up [https://svn.boost.org/trac/boost/changeset/74663 changeset 74663] by
 rogeeff, who I therefore put in CC.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6331>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:08 UTC