From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4154 invoked by alias); 18 Nov 2008 22:14:13 -0000 Received: (qmail 29736 invoked by uid 48); 18 Nov 2008 22:12:47 -0000 Date: Tue, 18 Nov 2008 22:14:00 -0000 Subject: [Bug c++/38172] New: warn_unused_result does not work with structs not containing a copy constructor X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pinskia at gcc dot gnu dot org" 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: 2008-11/txt/msg01526.txt.bz2 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