|
Boost : |
Subject: Re: [boost] Clang 4.0.0 MPL error in Boost next.hpp and prior.hpp
From: Edward Diener (eldiener_at_[hidden])
Date: 2017-03-25 22:27:21
On 3/25/2017 10:46 AM, Peter Dimov via Boost wrote:
> Edward Diener wrote:
>
>> There is also BOOST_PP_VARIADICS_MSVC, which provides lots of special
>> VC++ variadics workarounds.
>
> Yes there was, thanks for the hint.
>
> #define BOOST_PP_CONFIG_FLAGS() 1
> #include <boost/preprocessor/config/config.hpp>
>
> #define BOOST_PP_VARIADICS_MSVC 0
>
> #include <boost/mpl/list.hpp>
> #include <boost/mpl/push_front.hpp>
>
> int main()
> {
> namespace mpl = boost::mpl;
>
> using L = mpl::list<>;
> using L2 = mpl::push_front<L, void>;
> }
>
> works.
>
> The reason is
>
> # elif defined _MSC_VER && _MSC_VER >= 1400 && (defined(__clang__) ||
> !defined __EDG__ || defined(__INTELLISENSE__) ||
> defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700)
> # define BOOST_PP_VARIADICS 1
> # undef BOOST_PP_VARIADICS_MSVC
> # define BOOST_PP_VARIADICS_MSVC 1
>
> which defines BOOST_PP_VARIADICS_MSVC for Clang and must not.
I am well aware of what is in config.hpp and why.
>
> You can tell Clang to not define _MSC_VER (-fmsc-version="0"), but MS's
> headers don't work with that yet (although STL said they are going to.)
>
> -fno-ms-compatibility is default for Clang/C2 at least, so I think that
> the above should just define BOOST_PP_VARIADICS_MSVC to 0 on Clang.
My problem is that I do not know what -fno-ms-compatibility sets as
predefined macros. I suppose I can test it and then try to adjust
config.hpp accordingly but I hate doing something when there is no
documentation and things can change anytime clang, or is it Microsoft
with Clang/C2, gets it in their head to change things again. I do not
even know what -fno-ms-compatibility does as far as the preprocessor is
concerned; does this mean we are back to clang's normal C++ standard
preprocessor as in clang for Linux or clang for Windows targeting
mingw(-64)/gcc ? I know I am being unreasonably stubborn but I
absolutely hate it when clang or a Microsoft refuses to document
something and then expects everyone to jump through hoops trying to
figure out what they have done and/or react to what they decide to do
next. My guess, through some unofficial blogs, is that
-fno-ms-compatibility sets __clang__, _MSC_VER, and __GNUC__ to various
values.
I can test this with various releases of clang and the clang-win
toolset, but I have no idea even how to invoke clang/C2 in
VS2015/VS2017, since there is no documentation about clang/C2 in the
former and there is no documentation for anything in the latter.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk