[cfe-dev] invalid-token-paste
James Dennett
james.dennett at gmail.com
Wed Jul 18 19:13:12 PDT 2012
On Wed, Jul 18, 2012 at 6:35 PM, Shang Yu <yusunn at gmail.com> wrote:
> Hi James, this code is just a simplified example. In fact I
> encountered the problem when I'm testing clang against boost. Please
> see the attachment.
In the middle of the error message I see
E:\SRC\LIBS\boost_1_49_0\boost/preprocessor/tuple/elem.hpp:36:114: note:
expanded from macro 'BOOST_PP_TUPLE_ELEM'
...n), BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM_E_, size), tuple))
and line 36 of boost/preprocessor/tuple/elem.hpp is inside a
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
block that presumably works around some MSVC problem, but in doing so
relies on non-portable token pasting in this case.
I don't know enough of the magic that is BOOST_PP_CONFIG_FLAGS to know
why it's following that path -- maybe your clang is configured in such
a way that Boost thinks that it's MSVC++ -- but Clang doesn't have
complete emulation of MSVC++ quirks, so if that's the case I'm not
shocked that this isn't working. (If you look ahead to line 47 of the
same file for its more portable definition of BOOST_PP_TUPLE_ELEM
you'll see that it doesn't try to concatenate the 'tuple' macro
argument onto the previous token.)
It looks like you might want to pass
'-DBOOST_PP_CONFIG_FLAGS=(BOOST_PP_CONFIG_STRICT()') or similar on
your command line to tell boost.preprocessor to assume a conforming
preprocessor. (Or just -DBOOST_PP_CONFIG_FLAGS=1, looking at
boost/preprocessor/config/config.hpp.)
More information about the cfe-dev
mailing list