From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11721 invoked by alias); 17 Jan 2006 00:42:42 -0000 Received: (qmail 11566 invoked by uid 48); 17 Jan 2006 00:42:41 -0000 Date: Tue, 17 Jan 2006 00:42:00 -0000 Subject: [Bug c++/25814] New: Request for new warning X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "Raimund dot Merkert at baesystems dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-01/txt/msg01604.txt.bz2 List-Id: I'd like to request a warning to notify that a statement like "X x(const Y&)" is parsed as function declaration and not a definition of variable x. See the code below. At least as couple of PRs have been filed (9217,19503) on this topic. I've just spent at least 2 hrs trying to figure out why my constructor and destructor were not called and did not show up in the assembly code either. I think this particular problem might affect users that use the resource-acquisition idiom. The real problem is that the code compiles and links and runs without problems, except it doesn't actually work. #include struct Y {}; struct X { inline X (const Y&) {} inline ~X () { ::std::printf("1\n"); } }; int main() { X x(Y()); return 0; } -- Summary: Request for new warning Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: Raimund dot Merkert at baesystems dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25814