From patchwork Wed Apr 4 14:39:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 150743 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 4A106B701D for ; Thu, 5 Apr 2012 00:39:54 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1334155195; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=3A6yPAq s0RrC8GTxCMZdwkBki+c=; b=u4Q5nbiJuyHliLIQCrKz8aSpLIqNsr2bEl8yy5f 5r+YWPMqOT4nkJmNgEMYsFP+ktAEUPv0/T8qiAUFPMnK+6gsX/4lzmK7djKnWf5C LmwwyFieeKAgNEcsP4bW55Cw+KZAU4423pSmMWVuHb7M67IZASjz0it3lJxkRGu4 D0eA= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=KDYkXI6IZ6Z1R4dsbo8VO4MLWnBnek4IWeMT7RLyy7AXSDXC17BHgl1F7s5P3H b2pWexcFS9V+gSQ280HXFb1nhHJDfHWI/oUj+UDXpSlQlJtCi8QTrGammjxYvZ27 4h6q4zSgXdJKnKnLWoemyMynp9k1mJQiHPtozsKP+Jv2I=; Received: (qmail 460 invoked by alias); 4 Apr 2012 14:39:51 -0000 Received: (qmail 445 invoked by uid 22791); 4 Apr 2012 14:39:49 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, SPF_HELO_PASS, TW_FN, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 04 Apr 2012 14:39:33 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q34EdW8d030210 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 4 Apr 2012 10:39:32 -0400 Received: from [10.3.113.125] (ovpn-113-125.phx2.redhat.com [10.3.113.125]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q34EdWJn015000 for ; Wed, 4 Apr 2012 10:39:32 -0400 Message-ID: <4F7C5D23.8050809@redhat.com> Date: Wed, 04 Apr 2012 10:39:31 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/52845 (bogus warning with empty lambda) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org My patch for return type deduction forgot to update the fntype local variable in finish_function, leading to a bogus warning about a missing return statement. Tested x86_64-pc-linux-gnu, applying to trunk. commit 12a282edca78579074f5f4180cd2dce1edebd2bf Author: Jason Merrill Date: Wed Apr 4 10:14:46 2012 -0400 PR c++/52845 * decl.c (finish_function): Update fntype after deducing return type. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index d210f19..e2f01d5 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -13518,6 +13518,7 @@ finish_function (int flags) "deduced to %"); } apply_deduced_return_type (fndecl, void_type_node); + fntype = TREE_TYPE (fndecl); } /* Save constexpr function body before it gets munged by diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn4.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn4.C new file mode 100644 index 0000000..2afeccf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn4.C @@ -0,0 +1,7 @@ +// PR c++/52845 +// { dg-options "-std=c++11 -Wall" } + +void f() +{ + [](){}; +}