Bug 238443

Summary: [GLIB] Build error in GraphicsContextState.cpp (error: no match for 'operator!=') in Ubuntu LTS after r291696
Product: WebKit Reporter: Diego Pino <dpino>
Component: New BugsAssignee: Diego Pino <dpino>
Status: RESOLVED FIXED    
Severity: Normal CC: aperez, lmoura, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch ews-feeder: commit-queue-

Description Diego Pino 2022-03-28 03:45:14 PDT
[GLIB] Build error in GraphicsContextState.cpp (error: no match for 'operator!=') in Ubuntu LTS after r291696
Comment 1 Diego Pino 2022-03-28 03:47:27 PDT
Created attachment 455896 [details]
Patch
Comment 2 Adrian Perez 2022-03-28 04:05:13 PDT
Comment on attachment 455896 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=455896&action=review

> Source/WebCore/platform/graphics/GraphicsTypes.h:90
> +}

This cannot work, moving the function outside of the “class” block means
that now there is no implicit “this”, and that no operator== is defined
at all for CompositeMode. You need to leave this one as it was.
Comment 3 Diego Pino 2022-03-28 05:19:25 PDT
Created attachment 455903 [details]
Patch
Comment 4 Diego Pino 2022-03-28 06:11:53 PDT
The build error from the Ubuntu LTS build bot was:

```
Source/WebCore/platform/graphics/GraphicsContextState.cpp:60:84: error: no match for ‘operator!=’ (operand types are ‘const WebCore::CompositeMode’ and ‘WebCore::CompositeMode’)
   60 |         changeFlags.set(change, !lastDrawingState || (*lastDrawingState).*property != this->*property);
```

https://build.webkit.org/#/builders/68/builds/12304/steps/8/logs/stdio
Comment 5 EWS 2022-03-28 10:05:21 PDT
Committed r291970 (248935@main): <https://commits.webkit.org/248935@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 455903 [details].
Comment 6 Radar WebKit Bug Importer 2022-03-28 10:06:16 PDT
<rdar://problem/90929679>
Comment 7 Lauro Moura 2022-03-28 12:23:04 PDT
FTR, this seems to be related to changes to the C++20 equality/spaceship operators in GCC 10

Sample godbolt: https://godbolt.org/z/GWen331rM

GCC C++20 support: https://gcc.gnu.org/projects/cxx-status.html#cxx20

Especially the following spec, first supported in gcc10: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1185r2.html#wording

> A defaulted != operator function for a class C with parameters x and y is defined as deleted if

> (snip list of cases where != would be deleted.)

> Otherwise, the operator function yields (x == y) ? false : true if an operator == with the original order of parameters was selected, or (y == x) ? false : true otherwise.

So, GCC >10 correctly defined the defaulted `!=` operator, while older GCC's needed them to be explicitly defined (like the patch did), as it did not implement this behavior.