mp_similar: error with gcc and clang when using template classes
tobias-loew opened this issue · 2 comments
Hi,
the current trunk versions of gcc and clang produce ambiguity errors when instantiating mp_similar with the same template class twice. e.g.
#include
#include <boost/mp11.hpp>
int main(){
static constexpr bool b = boost::mp11::mp_similar<std::list, std::list>::value;
}
I've already filed bug-reports:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93155
https://bugs.llvm.org/show_bug.cgi?id=44459
Please find here an example:
https://godbolt.org/z/Wzaa6_
After reading [temp.deduct.partial] I think that gcc and clang are right with flagging mp_similar_impl as ambiguous, since (MSVC erroneously can compile the example, but when compiling the equivalent function-template it also results in an ambiguity error
template<class... T> struct mp_similar_impl {};
template<class T>
void f(mp_similar_impl<T, T>) {}
template<template<class...> class L, class... T1, class... T2>
void f(mp_similar_impl<L<T1...>, L<T2...>>) {}
int main() {
f(mp_similar_impl<std::list<int>, std::list<int>>{}); // error ambiguous
}