https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
--- Comment #55 from Ed Catmur <ed at catmur dot uk> --- (In reply to Roman Krotov from comment #54) [[nodiscard]] is in C23, so we can expect that attribute to be adopted where people intend that behavior (warning suppressible by cast to void) as opposed to the nonportable [[gnu::warn_unused_result]] (warning not suppressible by cast to void). So this problem will resolve itself, over time.