[PATCH] D103938: Diagnose -Wunused-value based on CFG reachability

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 23 09:58:06 PDT 2021


aaron.ballman added a comment.

In D103938#3013503 <https://reviews.llvm.org/D103938#3013503>, @thakis wrote:

> This flags this code from absl:
>
>   template <typename ValueT, typename GenT,
>             typename std::enable_if<std::is_integral<ValueT>::value, int>::type =
>                 (GenT{}, 0)>
>   constexpr FlagDefaultArg DefaultArg(int) {
>     return {FlagDefaultSrc(GenT{}.value), FlagDefaultKind::kOneWord};
>   }
>
> (https://source.chromium.org/chromium/chromium/src/+/main:third_party/abseil-cpp/absl/flags/internal/flag.h;l=293?q=third_party%2Fabseil-cpp%2Fabsl%2Fflags%2Finternal%2Fflag.h)
>
>   ../../third_party/abseil-cpp/absl/flags/internal/flag.h:293:16: warning: left operand of comma operator has no effect [-Wunused-value]
>                 (GenT{}, 0)>
>                  ^   ~~
>   ../../third_party/abseil-cpp/absl/flags/internal/flag.h:293:16: warning: left operand of comma operator has no effect [-Wunused-value]
>                 (GenT{}, 0)>
>                  ^   ~~
>
> I guess it has a SFINAE effect there?

Sorry for having missed this comment before when reviewing the code @thakis, thanks for pinging on it! That does look like a false positive assuming it's being used for SFINAE. @ychen, can you take a look (and revert if it looks like it'll take a while to resolve)?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103938/new/

https://reviews.llvm.org/D103938



More information about the cfe-commits mailing list