More crazy issues here, blocking meaningful work :(
Consider the below: it doesn't compile, tries to use the move constructor. If I
define bar in class then things work. Seems kind of broken optimization.

struct type
{
  type() { }
  type(const type&) { }

private:
  type(type&&);
};

template<typename _Tp>
  struct identity
  {
    typedef _Tp type;
  };

template<typename _Tp>
  inline _Tp&&
  forward(typename identity<_Tp>::type&& __t)
  { return __t; }

struct vec
{
  template<typename _Args>
    void
    bar(_Args&& __args);
/*
    {
      type(forward<_Args>(__args));
    }
*/
};

template<typename _Args>
  void
  vec::bar(_Args&& __args)
  {
    type(forward<_Args>(__args));
  }

int main()
{
  vec v;
  type c;
  v.bar(c);
}


-- 
           Summary: C++0x: move overloading problem with move constructor
                    and copy constructor
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pcarlini at suse dot de


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

Reply via email to