[llvm-bugs] [Bug 50366] New: clang++ prints bogus error: use of overloaded operator '!=' is ambiguous

via llvm-bugs llvm-bugs at lists.llvm.org
Sun May 16 12:30:01 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50366

            Bug ID: 50366
           Summary: clang++ prints bogus error: use of overloaded operator
                    '!=' is ambiguous
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yuri at tsoft.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

The Gecode project https://github.com/Gecode/gecode (release/6.3.0 branch
rev.ad52315) fails with -std=c++2a:

> In file included from gecode/float/var-imp/float.cpp:41:
> In file included from ./gecode/float.hh:833:
> ./gecode/float/val.hpp:319:18: error: use of overloaded operator '!=' is ambiguous (with operand types 'const Gecode::FloatVal::FloatValImpType' (aka 'const interval<double,
>       policies<save_state<Float::Rounding>, checking_strict<double> > >') and 'const Gecode::FloatVal::FloatValImpType')
>       return x.x != y.x;
>              ~~~ ^  ~~~
> ./gecode/third-party/boost/numeric/interval/interval.hpp:85:8: note: candidate function
>   bool operator!= (const interval_holder& r) const;
>        ^
> ./gecode/third-party/boost/numeric/interval/interval.hpp:84:8: note: candidate function
>   bool operator== (const interval_holder& r) const;
>        ^
> ./gecode/third-party/boost/numeric/interval/interval.hpp:84:8: note: candidate function (with reversed parameter order)
> In file included from gecode/float/rel.cpp:36:
> In file included from ./gecode/float/rel.hh:46:
> In file included from ./gecode/float.hh:833:
> ./gecode/float/val.hpp:296:18: warning: ISO C++20 considers use of overloaded operator '==' (with operand types 'const Gecode::FloatVal::FloatValImpType' (aka 'const interval<double,
>       policies<save_state<Float::Rounding>, checking_strict<double> > >') and 'const Gecode::FloatVal::FloatValImpType') to be ambiguous despite there being a unique best viable function
>       [-Wambiguous-reversed-operator]
>       return x.x == y.x;
>              ~~~ ^  ~~~
> ./gecode/third-party/boost/numeric/interval/interval.hpp:84:8: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
>   bool operator== (const interval_holder& r) const;
>        ^

Both operand types in the error message are same: 'const
Gecode::FloatVal::FloatValImpType'
It doesn't make sense that type order reversal can cause ambiguity.

Additionally, when compiled with -Wno-ambiguous-reversed-operator this error
message is still printed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210516/bd232caa/attachment.html>


More information about the llvm-bugs mailing list