http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46643
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-11-24 18:27:58 UTC --- It has nothing to do with templates but rather non-PODs: class foo { public: int baz() __attribute__((warn_unused_result)); private: int a; }; foo g(void) __attribute__((warn_unused_result)); int main(void) { foo b; g(); return 0; }