From patchwork Mon Dec 1 17:11:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 416517 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4D5B714011B for ; Tue, 2 Dec 2014 04:11:52 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=IcU2hvZtSUUfVHdiMgZX3x3+EeGzQ32/1VOnE7z7485 gZwJ2RRzu99X8LrSnhs8otFrb8Svl4c1GEjjIMElPFPC1Yqx64thA9boyJL5zXyW A+ITsHBv24NVDfFZ9e4DbgnJKnWblVwYV6XTVyJWAo7F0LglGPlwROLGuoO42Fhw = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=dqROwa0FiEcljD618JvlW1VdY6I=; b=mSGf1ZYM2EeiALMiF RZfPWrtZjkV3dr7W0RV85hS9un0AC2NOGm4j1ME9Db74yUODoWKoVvaTOpPPnqp0 mtMkP7Af+oTZh8hCMNBeqttziGfn0Ko++UEXsBgKDzP+gn7TpsiQiImjKPD2pkzs H0Ok6gzyl2rLKxSr/YvOGjTBL8= Received: (qmail 3906 invoked by alias); 1 Dec 2014 17:11:45 -0000 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 Received: (qmail 3894 invoked by uid 89); 1 Dec 2014 17:11:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: userp1040.oracle.com Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 01 Dec 2014 17:11:43 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id sB1HBetE031163 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 1 Dec 2014 17:11:41 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id sB1HBcOK009778 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 1 Dec 2014 17:11:40 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id sB1HBcYg013055; Mon, 1 Dec 2014 17:11:38 GMT Received: from [192.168.1.4] (/79.37.130.251) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 01 Dec 2014 09:11:37 -0800 Message-ID: <547CA147.9020802@oracle.com> Date: Mon, 01 Dec 2014 18:11:35 +0100 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 60859 X-IsSubscribed: yes Hi, I'm pretty sure that we should accept this. Tested x86_64-linux. Thanks, Paolo. //////////////////// /cp 2014-12-01 Paolo Carlini PR c++/60859 * decl.c (reshape_init_r): Do not reject value-initialization of scalar array element. /testsuite 2014-12-01 Paolo Carlini PR c++/60859 * g++.dg/cpp0x/initlist88.C: New. Index: cp/decl.c =================================================================== --- cp/decl.c (revision 218217) +++ cp/decl.c (working copy) @@ -5511,9 +5511,15 @@ reshape_init_r (tree type, reshape_iter *d, bool f { if (SCALAR_TYPE_P (type)) { - if (complain & tf_error) - error ("braces around scalar initializer for type %qT", type); - init = error_mark_node; + if (cxx_dialect < cxx11 + /* Isn't value-initialization. */ + || CONSTRUCTOR_NELTS (init) > 0) + { + if (complain & tf_error) + error ("braces around scalar initializer for type %qT", + type); + init = error_mark_node; + } } else maybe_warn_cpp0x (CPP0X_INITIALIZER_LISTS); Index: testsuite/g++.dg/cpp0x/initlist88.C =================================================================== --- testsuite/g++.dg/cpp0x/initlist88.C (revision 0) +++ testsuite/g++.dg/cpp0x/initlist88.C (working copy) @@ -0,0 +1,4 @@ +// PR c++/60859 +// { dg-do compile { target c++11 } } + +int a[] = { {} };