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

--- Comment #20 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Also crashes with 4.8.

markus@x4 tmp % < tcp_client.ii
template <typename> struct __and_;
template <typename> class function;
template <typename _Functor> class _Base_manager {
protected:
  static _Functor *_M_get_pointer(int) {}
};

template <typename, typename> class A;
template <typename _Res, typename _Functor, typename... _ArgTypes>
class A<_Res(_ArgTypes...), _Functor> : _Base_manager<_Functor> {
public:
  static _Res _M_invoke(const int &) {
    (*_Base_manager<_Functor>::_M_get_pointer(0))();
  }
};

template <typename, typename> using __check_func_return_type = int;
template <typename _Res, typename... _ArgTypes>
class function<_Res(_ArgTypes...)> {
  template <typename> using _Invoke = decltype(0);
  template <typename _Functor>
  using _Callable = __and_<__check_func_return_type<_Invoke<_Functor>, _Res>>;
  template <typename, typename> using _Requires = int;

public:
  template <typename _Functor, typename = _Requires<_Callable<_Functor>, void>>
  function(_Functor);
  using _Invoker_type = _Res (*)(const int &);
  _Invoker_type _M_invoker;
};

template <typename _Res, typename... _ArgTypes>
template <typename _Functor, typename>
function<_Res(_ArgTypes...)>::function(_Functor) {
  _M_invoker = A<_Res(), _Functor>::_M_invoke;
}

class B {
public:
  void configuration();
  void run(int, int, function<void()>);
};
main() {
  B app;
  app.run(0, 0, [&] { app.configuration(); });
}

markus@x4 tmp % /usr/x86_64-pc-linux-gnu/gcc-bin/4.8.4/g++ -std=gnu++1y -flto
-g -O2 -r -nostdlib -fno-inline -flto-partition=max tcp_client.ii
lto1: internal compiler error: in build_abbrev_table, at dwarf2out.c:7478

Reply via email to