host:~$ cat bogus.cpp struct S { int x, y; }; int main(int argc, char *argv[]) { struct S foo; int S::*bar = &S::x; foo.*bar = 5; return foo.*bar; } host:~$ g++ -o bogus bogus.cpp -Wunused bogus.cpp: In function 'int main(int, char**)': bogus.cpp:5:12: warning: variable 'foo' set but not used [-Wunused-but-set-variable] bogus.cpp:6:11: warning: variable 'bar' set but not used [-Wunused-but-set-variable] host:~$ g++ --version g++ (Ubuntu 20100530-0ubuntu1) 4.6.0 20100530 (experimental) [trunk revision 160047]
-- Summary: Bogus set but not used when using pointer to member operators Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: davi dot arnaut at sun dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44619