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

            Bug ID: 103250
           Summary: Valarray replacement type introduces ambiguity
           Product: gcc
           Version: 10.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: egil.brendsdal at gmail dot com
  Target Milestone: ---

Version/System/Options:

Using built-in specs.
COLLECT_GCC=/usr/pkg/gcc10/bin/gcc
COLLECT_LTO_WRAPPER=/usr/pkg/gcc10/libexec/gcc/x86_64-redhat-linux/10.3.0/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../gcc-10.3.0/configure --disable-libstdcxx-pch --enable-nls
--with-libiconv-prefix=/usr --enable-__cxa_atexit
--with-gxx-include-dir=/usr/pkg/gcc10/include/c++/ --disable-multilib
--enable-libssp --enable-languages='c obj-c++ objc fortran c++' --enable-shared
--enable-long-long --with-local-prefix=/usr/pkg/gcc10 --enable-threads=posix
--with-boot-ldflags='-static-libstdc++ -static-libgcc
-Wl,-R/usr/pkg/gcc8/lib/gcc/x86_64-redhat-linux/8.4.0 -Wl,-R/usr/pkg/gcc8/lib64
-Wl,-R/usr/pkg/lib  ' --with-system-zlib --without-zstd --with-arch=nocona
--with-tune=nocona --with-fpmath=sse --prefix=/usr/pkg/gcc10
--build=x86_64-redhat-linux --host=x86_64-redhat-linux
--infodir=/usr/pkg/gcc10/info --mandir=/usr/pkg/gcc10/man
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.3.0 (GCC) 


Command line:

/usr/pkg/gcc10/bin/c++ -std=c++17 gcc_bug.cpp

Compiler output:

gcc_bug.cpp: In instantiation of 'auto f(size_t) [with T = int; Q = tag; size_t
= long unsigned int]':
gcc_bug.cpp:38:37:   required from here
gcc_bug.cpp:33:11: error: ambiguous overload for 'operator/' (operand types are
'std::valarray<qaz::num<int, tag> >' and 'std::valarray<qaz::num<int, tag> >')
   33 |   return x/x;
      |          ~^~
In file included from gcc_bug.cpp:1:
/usr/pkg/gcc10/include/c++/valarray:1188:1: note: candidate:
'std::_Expr<std::__detail::_BinClos<std::__divides, std::_ValArray,
std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__divides,
_Tp>::result_type> std::operator/(const std::valarray<_Tp>&, const
std::valarray<_Tp>&) [with _Tp = qaz::num<int, tag>; typename
std::__fun<std::__divides, _Tp>::result_type = qaz::num<int, tag>]'
 1188 | _DEFINE_BINARY_OPERATOR(/, __divides)
      | ^~~~~~~~~~~~~~~~~~~~~~~
gcc_bug.cpp:23:58: note: candidate: 'std::valarray<decltype ((x[0] / y[0]))>
qaz::operator/(const std::valarray<qaz::num<T, Q1> >&, const
std::valarray<qaz::num<T, Q2> >&) [with T = int; Q1 = tag; Q2 = tag; decltype
((x[0] / y[0])) = int]'
   23 |   template < typename T, typename Q1, typename Q2 > auto operator/(
const std::valarray< num<T,Q1> > &x, const std::valarray< num<T,Q2> > &y ) ->
std::valarray< decltype(x[0]/y[0]) >;
      |                                                          ^~~~~~~~


File generated by -save-temps is attached.

Reply via email to