Take: struct MyClass { }; typedef struct MyClass MyClass;
int Bar1( void ) __attribute__((warn_unused_result)) __attribute__((noinline)); MyClass Bar2( void ) __attribute__((warn_unused_result)) __attribute__((noinline)); int Bar1( void ) { return 0; } MyClass Bar2( void ) { } void Foo( void ) { Bar1(); // Warns Bar2(); // Does not warn } --- CUT --- In Foo, Bar1 and Bar2 should cause a warning, only Bar1 causes a warning with the C++ front-end. While both cause a warning to show up with the C front-end. -- Summary: warn_unused_result does not work with structs not containing a copy constructor Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38172