[cfe-dev] [clang-cl] error: pasting [MACRO] formed an invalid preprocessing token

Edward Diener eldlistmailingz at tropicsoft.com
Thu Jan 2 04:40:38 PST 2014

On 1/1/2014 1:52 PM, Astron B wrote:
> This is for the latest revision of clang. While compiling included boost
> code using clang-cl:
> C:\LLVM\\Release\bin>clang-cl -c code.cpp -IC:\\boost
> C:\\boost/mpl/not.hpp(47,0) :  error: pasting formed
>        'BOOST_PP_TUPLE_ELEM_E_3(', an invalid preprocessing token
>        [-Winvalid-token-paste]
> I found people recommending to solve the problem by disabling the error
> using -Wno-invalid-token-paste so I tried it with the following result:
> C:\\boost/mpl/or.hpp(34,12) :  error: operator 'defined' requires
>        an identifier
> #if defined(or)
>              ^

This particular error is fixed in the 'develop' branch of Boost MPL for 
the latest modular-boost using git. See 
https://svn.boost.org/trac/boost/wiki/TryModBoost for using 
modular-boost. You will also need the 'develop' branch changes for Boost 

However there are still a number of problems using the latest clang-cl 
with Boost which need to be addressed before it is a real possibility. I 
have already reported these problems as bugs in clang. The main general 
issues with Boost are:

1) clang-cl needs exception support.
2) clang-cl needs RTTI support.

Until these happen I would not suggest trying to use Boost with 
clang-cl. Of course you can try and then report errors as you find them 
to the clang bug tracker.

More information about the cfe-dev mailing list