http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38172
Jörg Richter <joerg.rich...@pdv-fs.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joerg.rich...@pdv-fs.de --- Comment #5 from Jörg Richter <joerg.rich...@pdv-fs.de> 2012-06-25 13:58:26 UTC --- Adding just a simple struct member makes the warning for Bar2 disappear again. Reopen? Or should I file a new PR? $ cat t.cc struct MyClass { int i; }; typedef struct MyClass MyClass; int Bar1( void ) __attribute__((warn_unused_result)); MyClass Bar2( void ) __attribute__((warn_unused_result)); void Foo( void ) { Bar1(); // Warns Bar2(); // Does not warn } $ gcc -c -o /dev/null t.cc t.cc: In function 'void Foo()': t.cc:13:9: warning: ignoring return value of 'int Bar1()', declared with attribute warn_unused_result [-Wunused-result] $ gcc -v Using built-in specs. COLLECT_GCC=/tools/pkg/gcc/4.7.1/bin/gcc COLLECT_LTO_WRAPPER=/tools/pkg/gcc/4.7.1/libexec/gcc/x86_64-unknown-linux-gnu/4.7.1/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: gcc-4.7.1/configure --enable-languages=c,c++ --disable-bootstrap --disable-nls --with-local-prefix=/not_existing_directory --with-as=/tools/pkg/binutils/2.21/bin/as --with-ld=/tools/pkg/binutils/2.21/bin/ld --prefix=/tools/pkg/gcc/4.7.1 Thread model: posix gcc version 4.7.1 (GCC) Also with 4.6.3