boostorg / mp11

C++11 metaprogramming library
http://boost.org/libs/mp11
239 stars 65 forks source link

For old gcc versions BOOST_MP11_HAS_TEMPLATE_AUTO isn't set #90

Open rolandschulz opened 8 months ago

rolandschulz commented 8 months ago

Old versions of gcc (7.1-8.2) don't define __cpp_nontype_template_parameter_auto but only __cpp_template_auto. Because of that BOOST_MP11_HAS_TEMPLATE_AUTO doesn't get set even though those versions support it. spirit checks both (https://github.com/boostorg/spirit/blob/59515f0e56aebdf958eadab30be99cac8872e723/include/boost/spirit/home/x3.hpp#L19). Would this make sense for mp11 too?

pdimov commented 8 months ago

Could be worth a try; looks like __cpp_template_auto is set for Clang down to 4.0, I wonder whether such an old compiler would be able to actually compile the things.

pdimov commented 8 months ago

Looks like GCC 7 has a pre-standard implementation of auto in template parameters - it retains the value, but not the type, which leads to odd things like 0L being treated as false. (Interestingly, this seems to be the case for MSVC 14.1 as well.)

So this leaves 8.1 and 8.2, and I wonder whether it's worth the bother, as I see 8.4 on ubuntu-20.04.

Lastique commented 7 months ago

There is now BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS in Boost.Config that indicates support for this feature. It includes older compilers.