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
Loading
Please register or sign in to comment