Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 9ae27447 authored by Pirama Arumuga Nainar's avatar Pirama Arumuga Nainar Committed by Sean Kim
Browse files

codec2: Fix ambiguity in operator overloads

Bug: http://b/323152930

Based on
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2468r1.html#programming-model,

> If you want an operator== that is used for rewrites (automatically
reversed, and != automatically generated), write only an operator==, and
make sure its return type is bool.

Do this by removing C2Param.h::operator!= for post-C++20.

This still leaves ambiguous definitions because the `using
T::operator==` added in aosp/2877698 creates functions with `const T&`
parameters.  Instead define a new operator== that delegates to the base
class - this function is given preference over rewrites in the base
class.  Define a similar operator!= for pre-c++20 as well.

With this change, -Wambiguous-reversed-operator warnings from
frameworks/av/media are also resolved.

There is one additional test fix to clarify that the template parameter
is also a C2Param.

Test: Presubmit in main branch and manual build in downstream pixel
branch.

Change-Id: If399d4acb06795ba41bfac5ebf1f26ef76e49f06
parent 4c6e3301
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment