Work around ICC 16 beta compiler bug in SFINAE expansion
Calling std::vector<int>'s constructor (or assign()) with two ints can
select one of two different overloads: the (size_t, value_type) overload
which fills with n copies of the value or (iterator, iterator) overload,
which would copy a range.
libstdc++ had some workarounds for this scenario, by using an indirect
dispatch to determine whether it was a pair of integrals or not. But
ever since the resolution of DR1234 (https://gcc.gnu.org/bugzilla/
show_bug.cgi?id=43813) with C++11's more expressive SFINAE, the
dispatching is done actually by the outer template by adding an extra
template parameter that requires std::iterator_traite<T> to expand.
That's where ICC fails: it expands std::iterator_traits<int> and that
fails. It should have ignored the expansion and discarded that overload.
The workaround is simple: pass different types as the parameters, which
means the compiler cannot select the overload containing a pair of
iterators.
/usr/include/c++/5/bits/stl_iterator_base_types.h(154): error: name followed by "::" must be a class or namespace name
typedef typename _Iterator::iterator_category iterator_category;
^
detected during:
instantiation of class "std::__iterator_traits<_Iterator, void> [with _Iterator=int]" at line 163
instantiation of class "std::iterator_traits<_Iterator> [with _Iterator=int]" at line 876 of "compiler/qv4ssa.cpp"
Change-Id: I52dd43c12685407bb9a6ffff13f5f783820213a5
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>