From patchwork Thu Apr 28 23:08:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 93346 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 03C5CB6F7D for ; Fri, 29 Apr 2011 09:09:26 +1000 (EST) Received: (qmail 6775 invoked by alias); 28 Apr 2011 23:09:21 -0000 Received: (qmail 6763 invoked by uid 22791); 28 Apr 2011 23:09:19 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from smtp206.alice.it (HELO smtp206.alice.it) (82.57.200.102) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 28 Apr 2011 23:09:05 +0000 Received: from [192.168.1.4] (79.52.194.192) by smtp206.alice.it (8.5.124.08) id 4D49918D0747E54E; Fri, 29 Apr 2011 01:09:03 +0200 Message-ID: <4DB9F370.6050705@oracle.com> Date: Fri, 29 Apr 2011 01:08:32 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110221 SUSE/3.1.8 Thunderbird/3.1.8 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 48606 X-IsSubscribed: yes 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 Hi, a small patch for a [4.7 Regression] ICE on invalid: apparently, as happens in other places in the same file, we want to check here too the return value of build_value_init for error_mark_node and bail out. Tested x86_64-linux. Ok? Thanks, Paolo. ////////////////// /cp 2011-04-29 Paolo Carlini PR c++/48606 * init.c (perform_member_init): Check build_value_init return value for error_mark_node. /testsuite 2011-04-29 Paolo Carlini PR c++/48606 * g++.dg/init/ctor10.C: New. Index: testsuite/g++.dg/init/ctor10.C =================================================================== --- testsuite/g++.dg/init/ctor10.C (revision 0) +++ testsuite/g++.dg/init/ctor10.C (revision 0) @@ -0,0 +1,9 @@ +// PR c++/48606 +// { dg-do compile } +// { dg-options "-fkeep-inline-functions" } + +struct S +{ + int &ref; + S() : ref() {}; // { dg-error "value-initialization of" } +}; Index: cp/init.c =================================================================== --- cp/init.c (revision 173136) +++ cp/init.c (working copy) @@ -513,8 +513,10 @@ perform_member_init (tree member, tree init) } else { - init = build2 (INIT_EXPR, type, decl, - build_value_init (type, tf_warning_or_error)); + tree value = build_value_init (type, tf_warning_or_error); + if (value == error_mark_node) + return; + init = build2 (INIT_EXPR, type, decl, value); finish_expr_stmt (init); } }