[Bug c++/53039] [4.7/4.8 Regression] including <functional> breaks std::is_convertible with template-pack expansion
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Fri Apr 20 06:49:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53039
--- Comment #7 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-04-20 06:48:39 UTC ---
I'm pretty sure that this is not related with <functional>, but instead with
some interaction between the <tuple> header and std::is_convertible. The
following variant still demonstrates the problem (I deliberately changed some
of the original names used in the code to be sure that they are not cause of
the problem):
#include <tuple>
template<bool, class T>
struct enable_if
{
typedef T type;
};
template <bool...>
struct Bs
{
static const bool value = true;
};
template <typename... Ts>
struct AType {
template <typename... Us,
typename enable_if<
Bs<std::is_convertible<Us, Ts>::value...>::value,
bool>::type = false
>
int foo(Us&&...)
{
return sizeof...(Us);
}
};
int main() {
AType<int, int> t;
return t.foo(1, 1);
}
(You can also add <type_traits>, but it is already added via <tuple>). If we
now add upfront
template <class, class>
struct is_convertible
{
static const bool value = true;
};
and replace the usage of std::is_convertible by is_convertible, the error does
no longer occur.
More information about the Gcc-bugs
mailing list