[Bug c++/84612] Overload resolution of operator* fails for valarray<double>
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Feb 28 17:42:00 GMT 2018
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.
More information about the Gcc-bugs
mailing list