Bug 235445 - Build failure with g++ 12: std::exchange undefined
Summary: Build failure with g++ 12: std::exchange undefined
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: All Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-21 09:29 PST by Mike Gorse
Modified: 2022-01-21 15:18 PST (History)
12 users (show)

See Also:


Attachments
Patch. (4.23 KB, patch)
2022-01-21 09:32 PST, Mike Gorse
no flags Details | Formatted Diff | Diff
Patch. (4.07 KB, patch)
2022-01-21 12:01 PST, Mike Gorse
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Gorse 2022-01-21 09:29:15 PST
We are trying to get openSUSE ready for the upcoming gcc 12 release. Building with the development version gives me a few errors like this:
/home/abuild/rpmbuild/BUILD/webkitgtk-2.34.3/Source/WTF/wtf/CompletionHandler.h:67:21: error: 'exchange' is not a member of 'std'
67 |         return std::exchange(m_function, nullptr)(std::forward<In>(in)...);

I'm not sure why this fails on 12 but not 11, but including <utility> fixes the build for me.
Comment 1 Mike Gorse 2022-01-21 09:32:41 PST
Created attachment 449667 [details]
Patch.
Comment 2 Michael Catanzaro 2022-01-21 09:33:03 PST
(In reply to Mike Gorse from comment #0)
> I'm not sure why this fails on 12 but not 11, but including <utility> fixes
> the build for me.

Some other libstdc++ header must have included it from somewhere. It's normal for libstdc++ to remove headers when not required by the standard. When that happens, if we are missing the header where it's needed, then we get a build failure. This is just part of normal uplift of a new compiler version.
Comment 3 Michael Catanzaro 2022-01-21 09:33:52 PST
Comment on attachment 449667 [details]
Patch.

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

> Source/WTF/wtf/CompletionHandler.h:30
>  #include <wtf/MainThread.h>
> +#include <utility>

I'm just going to ask that you alphabetize. The style bot is about to yell at you for that.
Comment 4 Mike Gorse 2022-01-21 11:36:03 PST
Thanks; I'll submit a new patch.
I also have a change for 2.34.4 to include <string> in IntegerToStringConversion.h, but it seems not to be needed in the development branch, so I didn't include it.
Comment 5 Mike Gorse 2022-01-21 12:01:15 PST
Created attachment 449680 [details]
Patch.
Comment 6 Michael Catanzaro 2022-01-21 12:52:00 PST
(In reply to Mike Gorse from comment #4)
> Thanks; I'll submit a new patch.
> I also have a change for 2.34.4 to include <string> in
> IntegerToStringConversion.h, but it seems not to be needed in the
> development branch, so I didn't include it.

You can attach it separately to this bug, and I'll ask for it to be added to the stable tree.
Comment 7 EWS 2022-01-21 13:48:48 PST
Committed r288379 (246276@main): <https://commits.webkit.org/246276@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 449680 [details].