https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90881
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> --- (In reply to Federico Kircheis from comment #4) > (In reply to Jonathan Wakely from comment #1) > > Confirmed. We shouldn't give that warning in unevaluated contexts (decltype, > > sizeof, etc.) because unevaluated operands have no effects at all, with or > > without the comma operator. > > The compiler flag is about unused variables, not statements without effects. > > I guess it would be nice for > > ---- > int main(){ > decltype(short(), int()) a = 1; > return a; > } > ---- > > to have a warning that the left operand is unused (as of today), since here > SFINAE does not kick in: > > -- > <source>: In function 'int main()': > <source>:2:21: warning: left operand of comma operator has no effect > [-Wunused-value] > 2 | decltype(short(), int()) a = 1; > | ^ > -- > > But maybe there are not enough use-cases to be worth to diagnostic it. With my patch, we wouldn't warn on this second testcase. But clang++ doesn't warn, either.