For the following example: $ cat /tmp/test.C struct A { int a; }; A mya; static A *get() { return &mya; } int main() { A *p = get (); p->a; // issue #1 get ()->a; // issue #2 return 0; } GCC only catches only one issue, clang both of them: $ g++ /tmp/test.C -Wall -Wextra /tmp/test.C: In function ‘int main()’: /tmp/test.C:13:6: warning: statement has no effect [-Wunused-value] p->a; ~~~^ $ clang++ /tmp/test.C -Wall -Wextra /tmp/test.C:13:6: warning: expression result unused [-Wunused-value] p->a; ~ ^ /tmp/test.C:15:11: warning: expression result unused [-Wunused-value] get ()->a; ~~~~~~ ^
Our warning talks about the statement, and without interprocedural analysis it can't see that get() doesn't have an effect. Clang's warning is better because it doesn't say anything about whether get() has an effect, just that get()->a doesn't use the result of the class member access.
I thought this might be a dup of something, but the closest things I can find are bug 66658, bug 58950, and bug 64639, but none of them are quite what I was looking for and are only "related" at best...