From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9106 invoked by alias); 25 Jun 2012 14:03:19 -0000 Received: (qmail 9070 invoked by uid 22791); 25 Jun 2012 14:03:17 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 25 Jun 2012 14:02:20 +0000 From: "joerg.richter@pdv-fs.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/38172] warn_unused_result does not work with structs not containing a copy constructor Date: Mon, 25 Jun 2012 14:03:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: joerg.richter@pdv-fs.de X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-06/txt/msg01643.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D38172 J=C3=B6rg Richter changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joerg.richter@pdv-fs.de --- Comment #5 from J=C3=B6rg Richter 2012-06-25 = 13:58:26 UTC --- Adding just a simple struct member makes the warning for Bar2 disappear aga= in. 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=3D/tools/pkg/gcc/4.7.1/bin/gcc COLLECT_LTO_WRAPPER=3D/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=3Dc,c++ --disable-bootstrap --disable-nls --with-local-prefix=3D/not_existing_direc= tory --with-as=3D/tools/pkg/binutils/2.21/bin/as --with-ld=3D/tools/pkg/binutils/2.21/bin/ld --prefix=3D/tools/pkg/gcc/4.7.1 Thread model: posix gcc version 4.7.1 (GCC) Also with 4.6.3