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 libstdc++/20758] operator-(const T&, const complex<T>&) vs operator-(const complex<T>&, const complex<T>&)


------- Additional Comments From kreckel at ginac dot de  2005-04-04 21:52 -------
Subject: Re:  operator-(const T&, const complex<T>&) vs
 operator-(const complex<T>&, const complex<T>&)

I don't see how you can trigger wrong behaviour with
operator-(const complex<T> &lhs, const T &rhs):

  template<typename _Tp>
    inline complex<_Tp>
    operator-(const complex<_Tp>& __x, const _Tp& __y)
    {
      complex<_Tp> __r = __x;
      __r.real() -= __y;
      return __r;
    }

Isn't the unary operator- a necessary ingredient for the bug because it
silently changes the sign of zero?



-- 


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


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