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

            Bug ID: 84612
           Summary: Overload resolution of operator* fails for
                    valarray<double>
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: niva at niisi dot msk.ru
  Target Milestone: ---

Created attachment 43527
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43527&action=edit
source file

We use gcc-7.3.0 configured with: 
/home/sap/gcc-infra-build/gcc/configure --prefix=/home/sap/local-gcc-7
--enable-languages=c,c++ --with-gmp=/home/sap/gcc-infra
--with-mpfr=/home/sap/gcc-infra --with-mpc=/home/sap/gcc-infra

Compilation of the attached file max.pass.cpp 

  LANG=C ~/local-gcc-7/bin/g++ -std=c++11 -O0 -S max.pass.cpp

results in 

max.pass.cpp: In function 'void cpp_main()':
max.pass.cpp:38:19: error: no match for 'operator*' (operand types are
'std::valarray<double>' and 'int')
         assert((v1*2).max() == 8.0);
                 ~~^~
We expected that 

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

is used after conversion of 2 to double.

Note that similar line of code (with *= instead of *):

         assert((v1*=2).max() == 8.0);

is compiled successfully.

Reply via email to