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++/84612] Overload resolution of operator* fails for valarray<double>


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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
For completeness, the standard says that the operator is defined like this:

template<class T> valarray<T> operator*(const valarray<T>&, const T&);

That's what libstdc++ provides, and it fails to deduce T in your example.

The libc++ version looks like:

template<class T> valarray<T> operator*(const valarray<T>&, const typename
valarray<T>::value_type&);

This only deduces T from the valarray<T> argument, so the test case works. But
that is a non-standard behaviour, it's not a bug that GCC doesn't compile this
test case, because we are following the standard.

I've filed a new issue with the standard committee proposing to change the
standard to do what libc++ does, and if that happens we will change GCC's
implementation.

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