id summary reporter owner description type status milestone component version severity resolution keywords cc 6331 [Boost.Test] g++ compilation error due to ambiguity between template 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) t0rt1e@… Gennadiy Rozental "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 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::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 struct boost::enable_if boost/test/tree/decorator.hpp:184:23: error: class boost::unit_test::decorator::enable_if }}} showing the conflict between {{{template 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." Bugs closed To Be Determined test Boost Development Trunk Regression fixed enable_if, disable_if rogeeff vexocide@…