This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/84612] Overload resolution of operator* fails for valarray<double>
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 28 Feb 2018 17:41:45 +0000
- Subject: [Bug c++/84612] Overload resolution of operator* fails for valarray<double>
- Auto-submitted: auto-generated
- References: <bug-84612-4@http.gcc.gnu.org/bugzilla/>
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.