[Bug c++/53039] [4.7/4.8 Regression] including <functional> breaks std::is_convertible with template-pack expansion

paolo.carlini at oracle dot com gcc-bugzilla@gcc.gnu.org
Fri Apr 20 12:38:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53039

--- Comment #10 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-04-20 12:37:33 UTC ---
So, the below is my final pure C++ testcase: if 1 is changed to 0 the code
compiles; likewise if 1 and 0 are swapped. Thus, it seems there is something
wrong in global front-end data structures:

template <class, class>
struct is_convertible
{
  static const bool value = true;
};

template<bool, class T>
struct enable_if
{
  typedef T type;
};

template <bool...>
struct Xs
{
  static const bool value = true;
};

#if 1
template<typename... Ts>
  class BType
    {
      template <typename... Us,
        typename enable_if<
               Xs<is_convertible<Us, Ts>::value...>::value,
               bool>::type = false>
        void fooX(Us&&...);
    };
#endif

template <typename... Ts>
  struct AType
    {
      template <typename... Us,
    typename enable_if<
               Xs<is_convertible<Us, Ts>::value...>::value,
               bool>::type = false>
        void foo(Us&&...);
    };

#if 0
template<typename... Ts>
  class CType
    {
      template <typename... Us,
        typename enable_if<
               Xs<is_convertible<Us, Ts>::value...>::value,
               bool>::type = false>
        void fooX(Us&&...);
    };
#endif

int main()
{
  AType<int, int> t;
  t.foo(1, 1);
}



More information about the Gcc-bugs mailing list