[Bug c++/64297] [5 Regression] ICE: canonical types differ for identical types

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Dec 15 16:00:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64297

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-15
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase for -std=c++11:

namespace std {
template <typename _Tp, _Tp> struct integral_constant {
  static constexpr _Tp value = 0;
  typedef integral_constant type;
};
typedef integral_constant<int, 0> false_type;
template <int> using __bool_constant = integral_constant<int, 0>;
template <typename...> struct __and_;
struct B;
template <typename> struct is_function;
template <typename> struct C;
template <typename _Tp, typename _Cp>
struct C<_Tp _Cp::*> : integral_constant<int, is_function<_Tp>::value> {};
template <typename _Tp> struct G : C<_Tp>::type {};
template <typename> struct is_function : false_type {};
template <typename _Res, typename... _ArgTypes>
struct is_function<_Res(_ArgTypes...) const &>;
template <typename _Tp> _Tp declval();
template <typename...> using _Require = int;
template <typename> class D;
template <typename... _Types>
struct H : integral_constant<int, sizeof...(_Types)> {};
template <typename> struct F;
template <typename... _ArgTypes> struct _Mem_fn_traits_base {
  using __result_type = int;
  using __arg_types = H<_ArgTypes...>;
};
template <typename _Res, typename _Class, typename... _ArgTypes>
struct F<_Res (_Class::*)(_ArgTypes...) const> : _Mem_fn_traits_base<
                                                     _ArgTypes...> {
  using __lvalue = integral_constant<int, 0>;
};
template <typename _MemFunPtr, int = G<_MemFunPtr>::value> class _Mem_fn_base {
  using _Traits = F<_MemFunPtr>;
  using _ArgTypes = typename _Traits::__arg_types;
  template <typename _Args>
  using _CheckArgs = __bool_constant<_Args::value >= _ArgTypes::value>;

public:
  using result_type = typename _Traits::__result_type;
  template <typename... _Args, typename = _Require<typename _Traits::__lvalue,
                                                   _CheckArgs<H<_Args...> > > >
  void operator()(...);
};
template <typename _Res, typename _Class>
struct D<_Res _Class::*> : _Mem_fn_base<_Res _Class::*> {};
template <typename _Member, typename _Class>
D<_Member _Class::*> __callable_functor(_Member _Class::*);
template <typename> class function;
template <typename, typename> using __check_func_return_type = int;
template <typename _Res, typename... _ArgTypes>
class function<_Res(_ArgTypes...)> {
  template <typename _Functor>
  using _Invoke = decltype(__callable_functor(std::declval<_Functor &>())(
      std::declval<_ArgTypes>...));
  template <typename> using _NotSelf = B;
  template <typename _Functor>
  using _Callable = __and_<_NotSelf<_Functor>,
                           __check_func_return_type<_Invoke<_Functor>, _Res> >;
  template <typename, typename> using _Requires = int;
  template <typename _Functor, typename = _Requires<_Callable<_Functor>, void>
>
  function(_Functor);
};
struct A {
  typedef bool X;
  template <int> X foo() const;
};
std::function<int()> b(&A::foo<0>);

This used to be rejected, but didn't ICE, still in r217241, and ICEs with
r217250, so almost certainly it is r217250 that changed it.



More information about the Gcc-bugs mailing list