Opened 8 years ago

Closed 8 years ago

#10467 closed Bugs (fixed)

Boost.Geometry fails to compile on OS X if sys/termios.h is included

Reported by: nneonneo Owned by: Barend Gehrels
Milestone: Boost 1.58.0 Component: geometry
Version: Boost 1.56.0 Severity: Regression
Keywords: Cc: nneonneo@…

Description

On OS X, sys/termios.h defines the symbol B0 as 0.

With Boost 1.56.0, including sys/termios.h before boost/geometry/algorithms/assign.hpp causes a compilation failure which looks like this:

In file included from test.cpp:2:
/opt/local/include/boost/geometry/algorithms/assign.hpp:320:50: error: expected a qualified name after 'typename'
template <BOOST_VARIANT_ENUM_PARAMS(typename A), BOOST_VARIANT_ENUM_PARAMS(typename B)>
                                                 ^
/opt/local/include/boost/variant/variant_fwd.hpp:164:5: note: expanded from macro 'BOOST_VARIANT_ENUM_PARAMS'
    BOOST_PP_ENUM_PARAMS(BOOST_VARIANT_LIMIT_TYPES, param)
    ^
/opt/local/include/boost/preprocessor/repetition/enum_params.hpp:24:71: note: expanded from macro 'BOOST_PP_ENUM_PARAMS'
#    define BOOST_PP_ENUM_PARAMS(count, param) BOOST_PP_REPEAT(count, BOOST_PP_ENUM_PARAMS_M, param)
                                                                      ^
/opt/local/include/boost/preprocessor/repetition/repeat.hpp:38:60: note: expanded from macro 'BOOST_PP_REPEAT_1'
# define BOOST_PP_REPEAT_1(c, m, d) BOOST_PP_REPEAT_1_I(c, m, d)
                                                           ^
note: (skipping 21 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/opt/local/include/boost/preprocessor/repetition/enum_params.hpp:30:67: note: expanded from macro 'BOOST_PP_ENUM_PARAMS_M'
# define BOOST_PP_ENUM_PARAMS_M(z, n, param) BOOST_PP_COMMA_IF(n) param ## n
                                                                  ^
<scratch space>:13:1: note: expanded from here
B0
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/sys/termios.h:291:12: note: expanded from
      macro 'B0'
#define B0      0
                ^

The problem is that BOOST_VARIANT_ENUM_PARAMS(typename B) expands to a series of type params including "typename B0", which is then further expanded to "typename 0" by the B0 macro, and that causes a compilation failure.

This is a regression: the observed behaviour did not appear under Boost 1.55.0.

Change History (2)

comment:1 by Robert Xiao <nneonneo@…>, 8 years ago

Cc: nneonneo@… added

comment:2 by awulkiew, 8 years ago

Milestone: To Be DeterminedBoost 1.58.0
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.