Fix -Wunused-result error on std::future::get() with newer Clang - #402
Open
mentalfl0w wants to merge 1 commit into
Open
Fix -Wunused-result error on std::future::get() with newer Clang#402mentalfl0w wants to merge 1 commit into
mentalfl0w wants to merge 1 commit into
Conversation
Newer Clang (shipped with macOS 27 / Xcode 26) marks std::future::get() as [[nodiscard]], causing -Werror builds to fail: TaskQueue.h:52:9: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result] Explicitly cast to (void) to acknowledge the discarded return value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Building with recent Clang (macOS 27 SDK / Xcode 27) fails when
-Werroris enabled:std::future::get()is now annotated[[nodiscard]]in newer libc++, and trantor compiles with-Wall -Wextra -Werror.Fix
Add
(void)cast to explicitly discard the return value, which is the conventional way to suppress this warning.Testing
-Werror.