BOOST_MPL_AUX_AGLORITHM_NAMESPACE_END in wrong place

In boost/mpl/if.hpp the BOOST_MPL_AUX_AGLORITHM_NAMESPACE_BEGIN macro is inside a test for BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION, but the corresponding BOOST_MPL_AUX_AGLORITHM_NAMESPACE_END is after the #endif that matches the test. This doesn't cause an error, since those macros only expand to anything meaningful for GCC3, which enters the first branch of the #if, so the begin/end macros are balanced - but it ain't right. Bug was found due to an error with missing #endif, which made GCC3 take a different path through that file and error. Note also those macros are spelled "AGLORITHM" not ALGORITHM. Untested patch attached. jon -- "Faith strikes me as intellectual laziness." - Robert Heinlein

On Wed, Jul 28, 2004 at 04:55:32PM +0100, Jonathan Wakely wrote:
In boost/mpl/if.hpp the BOOST_MPL_AUX_AGLORITHM_NAMESPACE_BEGIN macro is inside a test for BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION, but the corresponding BOOST_MPL_AUX_AGLORITHM_NAMESPACE_END is after the #endif that matches the test. This doesn't cause an error, since those macros only expand to anything meaningful for GCC3, which enters the first branch of the #if, so the begin/end macros are balanced - but it ain't right.
Bug was found due to an error with missing #endif, which made GCC3 take a different path through that file and error.
Note also those macros are spelled "AGLORITHM" not ALGORITHM.
Untested patch attached.
That patch was wrong, I think. Since GCC sometimes takes the BOOST_NO_TEMPLATE_PARTIAL_SPECIALISATION path (when that macro is defined explicitly by e.g. libs/range/test/partial_workaround.cpp) the namespace begin/end macros should be outside the BOOST_NO_TEMPLATE_PARTIAL_SPECIALISATION test so the namespace is there whichever code path the compiler takes. At least I think that's right. The patch attached to this mail should be used instead of the previous one (assuming my analysis is right). Going on holiday for the next 4 days, so I'm in no rush for this to be fixed. jon -- "Strange how potent cheap music is." - No�l Coward

Jonathan Wakely writes:
In boost/mpl/if.hpp the BOOST_MPL_AUX_AGLORITHM_NAMESPACE_BEGIN macro is inside a test for BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION, but the corresponding BOOST_MPL_AUX_AGLORITHM_NAMESPACE_END is after the #endif that matches the test. This doesn't cause an error, since those macros only expand to anything meaningful for GCC3, which enters the first branch of the #if, so the begin/end macros are balanced - but it ain't right.
Bug was found due to an error with missing #endif, which made GCC3 take a different path through that file and error.
Note also those macros are spelled "AGLORITHM" not ALGORITHM.
Untested patch attached.
Jonathan, Thanks for this one as well! I'll make sure it's fixed in the new MPL sources. -- Aleksey Gurtovoy MetaCommunications Engineering
participants (2)
-
Aleksey Gurtovoy
-
Jonathan Wakely