Closed Bug 1346345 Opened 3 years ago Closed 3 years ago

ipdl generated structures do not provide operator!=()

Categories

(Core :: IPC, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: bkelly, Assigned: mccr8)

Details

Attachments

(1 file)

I just ran into a situation where I could not compare two instances of an IPDL generated structure using `a != b`.  If I convert to `!(a == b)` then it compiles fine.

More specifically I have

  const T& a = GetT();
  Maybe<T> b;
  b.emplace(GetOtherT());

  a != b.ref() // does not compile

  !(a == b) // does compile
That should be:

  !(a == b.ref()) // does compile
Assignee: nobody → continuation
This generates methods that look like:

auto CacheQueryParams::operator!=(const CacheQueryParams& _o) const -> bool
{
    return (!(operator==(_o)));
}
I tested this by adding this call into ContentParent::InitInternal, after the last use of xpcomInit:
  MOZ_ASSERT(!(xpcomInit != xpcomInit));
Unions also don't have != methods, but given there are a huge number of them that would be needed (one for each case of the union) I'm inclined to leave things alone until somebody asks for them.
Comment on attachment 8846085 [details]
Bug 1346345 - Implement != operator for IPDL structs.

https://reviewboard.mozilla.org/r/119158/#review121432
Attachment #8846085 - Flags: review?(kchen) → review+
Pushed by amccreight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4cbac77c2f87
Implement != operator for IPDL structs. r=kanru
https://hg.mozilla.org/mozilla-central/rev/4cbac77c2f87
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.