Problem with BOOST_NO_CXX11_VARIADIC_TEMPLATES in gcc.hpp
I think I found a problem in config/compiler/gcc.hpp in Boost 1.56.0. I was trying to come up with a workaround for a bug having to do with variadic templates, when compiling with g++ 4.5.1 (on Linux Fedora 14). Modifying line 160 to turn on BOOST_NO_CXX11_VARIADIC_TEMPLATES for g++ versions earlier than 4.7 had not effect. I discovered that the version test in line 160 has no effect, because it is in a block (lines 153-164) that only pertains to g++ 4.2 or earlier, if compiled with -std=c++0x. The block for versions 4.3 and later (lines 145-151) always define BOOST_HAS_VARIADIC_TMPL and never BOOST_NO_CXX11_VARIADIC_TEMPLATES. I think that is a mistake, at least partially, because proposal N2555 is only supported in version 4.4. At any rate, someone should look at these lines and make some sense of them. The GCC support table shows general support for variadic templates in 4.3 and support for N2555 (with a long name) in 4.4. Furthermore, the bug that produces a message like this: "sorry, unimplemented: cannot expand 'Args ...' into a fixed-length argument list" was only fixed in g++ 4.7.0 (according to a bug report). That issue could also use a guard macro, as was done in one of the boost libraries ( BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST). -- Dick Hadsell 203-992-6320 Fax: 203-992-6001 Reply-to: hadsell@blueskystudios.com Blue Sky Studioshttp://www.blueskystudios.com 1 American Lane, Greenwich, CT 06831-2560
I think I found a problem in config/compiler/gcc.hpp in Boost 1.56.0. I was trying to come up with a workaround for a bug having to do with variadic templates, when compiling with g++ 4.5.1 (on Linux Fedora 14). Modifying line 160 to turn on BOOST_NO_CXX11_VARIADIC_TEMPLATES for g++ versions earlier than 4.7 had not effect.
I discovered that the version test in line 160 has no effect, because it is in a block (lines 153-164) that only pertains to g++ 4.2 or earlier, if compiled with -std=c++0x. The block for versions 4.3 and later (lines 145-151) always define BOOST_HAS_VARIADIC_TMPL and never BOOST_NO_CXX11_VARIADIC_TEMPLATES. I think that is a mistake, at least partially, because proposal N2555 is only supported in version 4.4.
I've just pushed a fix, not sure what happened there.
At any rate, someone should look at these lines and make some sense of them. The GCC support table shows general support for variadic templates in 4.3 and support for N2555 (with a long name) in 4.4. Furthermore, the bug that produces a message like this:
"sorry, unimplemented: cannot expand 'Args ...' into a fixed-length argument list"
was only fixed in g++ 4.7.0 (according to a bug report). That issue could also use a guard macro, as was done in one of the boost libraries ( BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST).
If this is a GCC specific bug, then I'm inclined to suggest that this is what BOOST_WORKAROUND is for: unless there are a lot of libraries needing this, or there's a consensus that variadic templates should be disabled altogether prior to 4.7? John.
On Saturday 23 August 2014 09:40:34 John Maddock wrote:
Furthermore, the bug that produces a message like this:
"sorry, unimplemented: cannot expand 'Args ...' into a fixed-length argument list"
was only fixed in g++ 4.7.0 (according to a bug report). That issue could also use a guard macro, as was done in one of the boost libraries ( BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST).
If this is a GCC specific bug, then I'm inclined to suggest that this is what BOOST_WORKAROUND is for: unless there are a lot of libraries needing this, or there's a consensus that variadic templates should be disabled altogether prior to 4.7?
I have a similar macro BOOST_LOG_NO_CXX11_ARG_PACKS_TO_NON_VARIADIC_ARGS_EXPANSION in Boost.Log. To my knowledge, this is a gcc-specific issue. I don't think that variadic templates should be disabled for gcc prior to 4.7, even with this problem, since the implementation is sufficient for many use cases.
On 08/23/2014 04:58 AM, Andrey Semashev wrote:
On Saturday 23 August 2014 09:40:34 John Maddock wrote:
If this is a GCC specific bug, then I'm inclined to suggest that this is what BOOST_WORKAROUND is for: unless there are a lot of libraries needing this, or there's a consensus that variadic templates should be disabled altogether prior to 4.7? I have a similar macro BOOST_LOG_NO_CXX11_ARG_PACKS_TO_NON_VARIADIC_ARGS_EXPANSION in Boost.Log. To my knowledge, this is a gcc-specific issue.
I don't think that variadic templates should be disabled for gcc prior to 4.7, even with this problem, since the implementation is sufficient for many use cases. I'm not a Boost developer, but it makes sense that this belongs with other workarounds. The GCC C++11 support table claims that 4.4 supports variadic templates. GCC treated the problem as a bug, whose report claims it is fixed in 4.7.0. That seems appropriate for a workaround. Since at least 2 libraries already need this workaround, I think it's reasonable to replace the library-specific macros with a general workaround macro.
Whatever the final decision, I would eventually like to know how to patch my copy of 1.56.0, including your fix for gcc.hpp. -- Dick Hadsell 203-992-6320 Fax: 203-992-6001 Reply-to: hadsell@blueskystudios.com Blue Sky Studioshttp://www.blueskystudios.com 1 American Lane, Greenwich, CT 06831-2560
I don't think that variadic templates should be disabled for gcc prior to 4.7, even with this problem, since the implementation is sufficient for many use cases. I'm not a Boost developer, but it makes sense that this belongs with other workarounds. The GCC C++11 support table claims that 4.4 supports variadic templates. GCC treated the problem as a bug, whose report claims it is fixed in 4.7.0. That seems appropriate for a workaround. Since at least 2 libraries already need this workaround, I think it's reasonable to replace the library-specific macros with a general workaround macro.
OK, I've added a new config macro - BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS - to develop. Test case failed for Intel-win as well as GCC, so apparently it's not just a GCC issue after all.
Whatever the final decision, I would eventually like to know how to patch my copy of 1.56.0, including your fix for gcc.hpp.
Grab the changed files from Github? John.
On 08/25/2014 02:03 PM, John Maddock wrote:
Whatever the final decision, I would eventually like to know how to patch my copy of 1.56.0, including your fix for gcc.hpp.
Grab the changed files from Github?
I'm not into github (or svn). I prefer to wait for official releases. Maybe someone can send me the changes off-list, if you want to avoid clutter. -- Dick Hadsell 203-992-6320 Fax: 203-992-6001 Reply-to: hadsell@blueskystudios.com Blue Sky Studioshttp://www.blueskystudios.com 1 American Lane, Greenwich, CT 06831-2560
Le 25/08/14 20:13, Richard Hadsell a écrit :
On 08/25/2014 02:03 PM, John Maddock wrote:
Whatever the final decision, I would eventually like to know how to patch my copy of 1.56.0, including your fix for gcc.hpp.
Grab the changed files from Github?
I'm not into github (or svn). I prefer to wait for official releases. Maybe someone can send me the changes off-list, if you want to avoid clutter.
You don't need to log. Just see https://github.com/boostorg/config/commit/2690cb8b3979a17df2bab4cdce62e2f0b0.... HTH, Vicente
On 08/25/2014 06:18 PM, Vicente J. Botet Escriba wrote:
You don't need to log. Just see https://github.com/boostorg/config/commit/2690cb8b3979a17df2bab4cdce62e2f0b0....
HTH, Vicente That would help, but the fix I am more interested in is for gcc.hpp. Has John committed that file?
-- Dick Hadsell 203-992-6320 Fax: 203-992-6001 Reply-to: hadsell@blueskystudios.com Blue Sky Studioshttp://www.blueskystudios.com 1 American Lane, Greenwich, CT 06831-2560
Le 26/08/14 17:40, Richard Hadsell a écrit :
On 08/25/2014 06:18 PM, Vicente J. Botet Escriba wrote:
You don't need to log. Just see https://github.com/boostorg/config/commit/2690cb8b3979a17df2bab4cdce62e2f0b0....
HTH, Vicente That would help, but the fix I am more interested in is for gcc.hpp. Has John committed that file?
https://github.com/boostorg/config/commit/4dc7c66c4d3622b2f9f8f2ee273804508a... Vicente
participants (4)
-
Andrey Semashev
-
John Maddock
-
Richard Hadsell
-
Vicente J. Botet Escriba