There is no way to get an error for ignoring the result of a function with attribute warn_unused_result. There should be something like -Werror=unused-return-value (or attribute error_unused_result).
-- Summary: no -Werror= for attribute warn_unused_result Product: gcc Version: 4.3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: esigra at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40614