From f446a79410b81067c982dc48563e2acccded1247 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 31 Jul 2015 00:30:00 -0700 Subject: Work around ICC 16 beta compiler bug in SFINAE expansion Calling std::vector'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 to expand. That's where ICC fails: it expands std::iterator_traits 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 --- src/qml/compiler/qv4ssa.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/qml/compiler/qv4ssa.cpp') diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index e61a602e64..c0669d3e47 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -530,7 +530,7 @@ class DominatorTree const int bbCount = function->basicBlockCount(); d->vertex = std::vector(bbCount, InvalidBasicBlockIndex); d->parent = std::vector(bbCount, InvalidBasicBlockIndex); - d->dfnum = std::vector(bbCount, 0); + d->dfnum = std::vector(size_t(bbCount), 0); d->semi = std::vector(bbCount, InvalidBasicBlockIndex); d->ancestor = std::vector(bbCount, InvalidBasicBlockIndex); idom = std::vector(bbCount, InvalidBasicBlockIndex); @@ -873,7 +873,7 @@ private: // - set the current node's depth to that of immediate dominator + 1 std::vector calculateNodeDepths() const { - std::vector nodeDepths(function->basicBlockCount(), -1); + std::vector nodeDepths(size_t(function->basicBlockCount()), -1); nodeDepths[0] = 0; foreach (BasicBlock *bb, function->basicBlocks()) { if (bb->isRemoved()) -- cgit v1.2.3