------- Comment #3 from Raimund dot Merkert at baesystems dot com 2006-01-17 12:32 ------- I would not consider myself a beginner, but I'm no c++ language laywer either. Usually the problem will get caught as soon as you try to invoke a method, but if it's something like a guard object, without methods, then it can be a problem. This is such an infrequent event (I think it happened to me before, years ago) it's easy to forget about this rule and no amount of teaching about it in books will help ( and I do use the Stroustrup book ).
I agree that it is probably hard to fix because it's a grammar problem, but might it be possible to warn about a locally unused declaration? Maybe it makes sense to warn about any local declaration (I've never really seen those)? Or maybe it's a statement that has no effect? Priority-wise, it's probably low considering the rare occurrence. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25814