Skip to content

Algorithm::unite: take std::vector instead of any Container

std::vector has a second template parameter - Allocator. Because of it, Clang and MSVC refuse to match a temporary std::vector<QSet> to Container<QSet>&&. And so FreeBSD and Windows KDevelop CI builds fail.

From https://en.cppreference.com/w/cpp/language/template_parameters : To match a template template argument A to a template template parameter P, [each of the template parameters of A must match corresponding template parameters of P exactly] (until C++17) [P must be at least as specialized as A] (since C++17).

The corresponding paper adopted in C++17: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0522r0.html

From https://clang.llvm.org/cxx_status.html#p0522 : (10): Despite being the resolution to a Defect Report, this feature is disabled by default in all language versions, and can be enabled explicitly with the flag -frelaxed-template-template-args in Clang 4 onwards. The change to the standard lacks a corresponding change for template partial ordering, resulting in ambiguity errors for reasonable and previously-valid code. This issue is expected to be rectified soon.

https://docs.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance?view=msvc-160 - Microsoft claims that P0522R0 is supported since Visual Studio 2017 15.5, but the MSVC implementation is apparently buggy.

Merge request reports