[Bug c++/59056] enable_if turns a non-ambiguous template into an ambiguous one
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Nov 9 12:58:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59056
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I must be misunderstanding something, because rewriting the class template
partial specializations as function templates (as per [temp.class.order]) shows
that one is more specialized than the other, as the functions are not
ambiguous:
#include <type_traits>
template <class T> class Foo {};
template <class X>
constexpr bool check()
{
return true;
}
template <class X, class Enable = void>
struct Bar {};
template<class X>
void func(Bar<X, typename std::enable_if< check<X>() >::type>) { }
template<class T>
int func(Bar<Foo<T>>) { return 0; }
void instance()
{
Bar< Foo<int> > av;
int i = func(av);
}
I thought if the partial specializations were ambiguous then these function
overloads should be too.
More information about the Gcc-bugs
mailing list