This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/42132] [C++0x] SFINAE failure with cv-qualifiers



------- Comment #7 from redi at gcc dot gnu dot org  2009-11-22 15:19 -------
In std::bind() the call function would be a template function, so argument
deduction is done and SFINAE applies.  Changing my testcase to use template
functions gives a different error:

#include <utility>

using std::declval;

template<typename Fn>
struct Binder
{
  Fn functor;

  template<typename... Arg>
  decltype( declval<Fn&>()( declval<Arg>()... ) )
  call(Arg&&... arg)
  {
    return functor(std::forward<Arg>(arg)...);
  }

  template<typename... Arg>
  decltype( declval<const Fn&>()( declval<Arg>()... ) )
  call(Arg&&... arg) const
  {
    return functor(std::forward<Arg>(arg)...);
  }

  template<typename... Arg>
  decltype( declval<volatile Fn&>()( declval<Arg>()... ) )
  call(Arg&&... arg) volatile
  {
    return functor(std::forward<Arg>(arg)...);
  }

  template<typename... Arg>
  decltype( declval<const volatile Fn&>()( declval<Arg>()... ) )
  call(Arg&&... arg) const volatile
  {
    return functor(std::forward<Arg>(arg)...);
  }

};

struct F
{
  int operator()(int) { return 0; }
};

int main()
{
  Binder<F> b = { };
  b.call(0);
}

Gives this:

g++ -std=c++0x bind.cc
bind.cc: In instantiation of 'decltype (declval<Fn&>()((#'template_id_expr' not
supported by pp_c_expression#)()...)) Binder<Fn>::call(Arg&& ...) [with Arg =
{int}, Fn = F, decltype (declval<Fn&>()((#'template_id_expr' not supported by
pp_c_expression#)()...)) = int]':
bind.cc:48:11:   instantiated from here
bind.cc:15:3: sorry, unimplemented: mangling template_id_expr
bind.cc:15:3: sorry, unimplemented: mangling template_id_expr

which looks like Bug 38712


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]