I've opened a bug to GCC, but I'd like to know if I'm right in my expectations.
Consider this proposal and the following fold expression:
(args < ...)
It should be equivalent to:
((args$0 < args$1) < ...) < args$n
Consider the following code:
#include <cassert>
int main() {
assert((0 < 42) < 3);
}
The assert compiles and works properly, it doesn't fail (as expected indeed, note that the result is not ((0 < 42) and (42 < 3)), the expression itself is quite unusual and meaningless).
On the other side, when using a fold expression:
template<int... I>
static constexpr bool f() {
return (I < ...);
}
int main() {
static_assert(f<0, 42, 3>(), "!");
}
The assert fails at compile time (GCC 6.1.0).
I'd expect it to compile because of what contained in the proposal.
It should succeed for it is equivalent to the example above that doesn't involve fold expressions.
The unpacked expression should be indeed: ((0 < 42) < 3).
Am I right or I'm missing something important here about fold expressions?