|
Boost : |
Subject: [boost] [Hana] "basic_tuple.hpp" bug when building with VS2017
From: Daniel Chen (danchen_at_[hidden])
Date: 2018-05-17 17:59:17
Hello,
Just installed Boost and Visual Studio 2017 a few days ago.
Here is a bug when building with Hana's "basic_tuple.hpp" header with Visual Studio 2017: In basic_tuple.hpp:
template <>
struct drop_front_impl<basic_tuple_tag> {
template <std::size_t N, typename Xs, std::size_t ...i>
static constexpr auto drop_front_helper(Xs&& xs, std::index_sequence<i...>) {
return hana::make_basic_tuple(
detail::ebo_get<detail::bti<i+N>>(static_cast<Xs&&>(xs))...
);
}
template <typename Xs, typename N>
static constexpr auto apply(Xs&& xs, N const&) {
constexpr std::size_t len = detail::decay<Xs>::type::size_;
return drop_front_helper<N::value>(static_cast<Xs&&>(xs), std::make_index_sequence<
N::value < len ? len - N::value : 0
>{}); //<Bug here - line 197 of basic_tuple.hpp
}
};
Upon building with "basic_tuple.hpp", the line highlighted in green reports an error:
"syntax error: unexpected token ')', expected 'id-expression'".
Focus on the line above that one:
N::value < len ? len - N::value : 0
If you add parentheses, the error goes away:
(N::value < len) ? len - N::value : 0
A similar bug occurs - and is fixed likewise - in the "string.hpp" header file at line 275, that is:
template <>
struct drop_front_impl<string_tag> {
...
template <char ...xs, typename N>
static constexpr auto apply(string<xs...> const& s, N const&) {
return helper<N::value>(s, std::make_index_sequence<
N::value < sizeof...(xs) ? sizeof...(xs) - N::value : 0
>{}); //<bug here - line 275 of string.hpp
}
I'm not sure if this is a Microsoft compiler issue (I will post to them as well), but I feel like someone should add those parentheses (and then some) to the line since it is safer - the "<" can be easily confused for a template bracket instead of a less-than sign by a parser.
Daniel Chen
Infinera
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk