[preprocessor] badly formed constant expression on Sun

Hello all, A Boost.Functional/OverloadedFunction regression test gives the errors below on a Boost.Preprocessor line: # if (BOOST_PP_VALUE) / 1000000000UL == 0 # define BOOST_PP_SLOT_TEMP_10 0 # elif (BOOST_PP_VALUE) / 1000000000UL == 1 # define BOOST_PP_SLOT_TEMP_10 1 # elif (BOOST_PP_VALUE) / 1000000000UL == 2 # define BOOST_PP_SLOT_TEMP_10 2 # elif (BOOST_PP_VALUE) / 1000000000UL == 3 ... "/opt/sunstudio12.1/bin/CC" +d -library=stlport4 -features=tmplife -features=tmplrefstatic -library=stlport4 -g -erroff=%none -m64 -KPIC -DBOOST_ALL_NO_LIB=1 -I".." -c -o "/scratch2/kbelco/boost/results/boost/bin.v2/libs/functional/overloaded_function/test/functor.test/sun-5.10/debug/address-model-64/stdlib-sun-stlport/functor.o" "../libs/functional/overloaded_function/test/functor.cpp" "../boost/preprocessor/slot/detail/shared.hpp", line 27: Error: Badly formed constant expression. "../boost/preprocessor/slot/detail/shared.hpp", line 29: Error: Badly formed constant expression. "../boost/preprocessor/slot/detail/shared.hpp", line 31: Error: Badly formed constant expression. ... http://www.boost.org/development/tests/trunk/developer/output/Sandia-sun-boo... Is (BOOST_PP_VALUE) / 1000000000UL not a valid constant expression on Sun 64-bits machines? I can't reproduce this error on my Sun C++ compiler installed on 32-bit Ubuntu Linux... so maybe this is about the actual Sun machine and not the Sun compiler... However, all Boost.Preprocessor tests pass on Sun... http://www.boost.org/development/tests/trunk/developer/preprocessor.html Any suggestion? Thanks a lot. --Lorenzo -- View this message in context: http://boost.2283326.n4.nabble.com/boost-preprocessor-badly-formed-constant-... Sent from the Boost - Dev mailing list archive at Nabble.com.

On Tue, 03 Apr 2012 19:27:40 -0700, lcaminiti wrote:
Is (BOOST_PP_VALUE) / 1000000000UL not a valid constant expression on Sun 64-bits machines?
32 vs. 64-bit shouldn't make a difference to the mechanism. I suppose it might matter if something was less than 32-bit.
I can't reproduce this error on my Sun C++ compiler installed on 32-bit Ubuntu Linux... so maybe this is about the actual Sun machine and not the Sun compiler... However, all Boost.Preprocessor tests pass on Sun... http://www.boost.org/development/tests/trunk/developer/preprocessor.html
Any suggestion?
Thanks a lot. --Lorenzo
I have no idea what the problem is (and I don't have access to the compiler/architecture to figure it out). What's BOOST_PP_VALUE defined as? Regards, Paul Mensonides

Paul Mensonides wrote
On Tue, 03 Apr 2012 19:27:40 -0700, lcaminiti wrote:
Is (BOOST_PP_VALUE) / 1000000000UL not a valid constant expression on Sun 64-bits machines?
32 vs. 64-bit shouldn't make a difference to the mechanism. I suppose it might matter if something was less than 32-bit.
I can't reproduce this error on my Sun C++ compiler installed on 32-bit Ubuntu Linux... so maybe this is about the actual Sun machine and not the Sun compiler... However, all Boost.Preprocessor tests pass on Sun... http://www.boost.org/development/tests/trunk/developer/preprocessor.html
Any suggestion?
Thanks a lot. --Lorenzo
I have no idea what the problem is (and I don't have access to the compiler/architecture to figure it out). What's BOOST_PP_VALUE defined as?
It's a bit different for me to be sure about what was going on but I think the following caused the error: # define BOOST_PP_ITERATION_PARAMS_1 \ (3, (0, BOOS_PP_SUB(BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, 2), \ "boost/functional/overloaded_function.hpp")) # include BOOST_PP_ITERATE() // Iterate over function arity. The issue goes away if I remove the PP_SUB from within the PARAMS_1 definition (that's how I worked around the issue, I iterate 2 to MAX and then SUB 2 from within the iteration frame). Is that expected or it's a bug in the Sun pp macro expansion? This issue only happened on Sun... Thanks a lot. --Lorenzo -- View this message in context: http://boost.2283326.n4.nabble.com/boost-preprocessor-badly-formed-constant-... Sent from the Boost - Dev mailing list archive at Nabble.com.

On Fri, Apr 13, 2012 at 12:51 PM, lcaminiti <lorcaminiti@gmail.com> wrote:
Paul Mensonides wrote
On Tue, 03 Apr 2012 19:27:40 -0700, lcaminiti wrote:
Is (BOOST_PP_VALUE) / 1000000000UL not a valid constant expression on Sun 64-bits machines?
32 vs. 64-bit shouldn't make a difference to the mechanism. I suppose it might matter if something was less than 32-bit.
I can't reproduce this error on my Sun C++ compiler installed on 32-bit Ubuntu Linux... so maybe this is about the actual Sun machine and not the Sun compiler... However, all Boost.Preprocessor tests pass on Sun...
http://www.boost.org/development/tests/trunk/developer/preprocessor.html
Any suggestion?
Thanks a lot. --Lorenzo
I have no idea what the problem is (and I don't have access to the compiler/architecture to figure it out). What's BOOST_PP_VALUE defined as?
It's a bit different for me to be sure about what was going on but I think the following caused the error:
# define BOOST_PP_ITERATION_PARAMS_1 \ (3, (0, BOOS_PP_SUB(BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, 2), \ "boost/functional/overloaded_function.hpp")) # include BOOST_PP_ITERATE() // Iterate over function arity.
The issue goes away if I remove the PP_SUB from within the PARAMS_1 definition (that's how I worked around the issue, I iterate 2 to MAX and then SUB 2 from within the iteration frame).
Is that expected or it's a bug in the Sun pp macro expansion? This issue only happened on Sun...
Did you try simply *_OVERLOAD_MAX - 2? The parameters supplied via ITERATION_PARAMS_x are (documented to be) evaluated parameters, so I should think the aforementioned should work (of course, I would think SUB should work, too). - Jeff
participants (3)
-
Jeffrey Lee Hellrung, Jr.
-
lcaminiti
-
Paul Mensonides