From patchwork Tue Oct 16 18:39:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 984973 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-487676-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="FzDMGZtp"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="dZVCDnH+"; dkim-atps=neutral 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 42ZPHN4bB7z9sCm for ; Wed, 17 Oct 2018 05:39:43 +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:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=NxCkqiR6vZSlMnFfKadk8v6qjpT0dRwuZ1B2jBV+HKbTSreNVF Bk7AmMbZB5KImvsUNFjVhCcRWmLJgkUH0uiuPH/tAhau5SOBI6CjH4GcDah/WcRD 3DnJzJeQM9NOMKn/RG2VJqLajo97dI1kh7UYIJdioPe74HRG8zp7Vn/y4= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=xzzIc/V7WJ2u86cpn3xsUYbQJ9c=; b=FzDMGZtprLL3EMDx72P8 5VkKbmtsqFwBcyMMdmyJ0W7PU5gPj06VASkXpjkd4Ncl9sIeHCpsZ3R0z/ub/+dY 3Hc4xgO02m1tHMW1uwm0jvgOEEv5u1+a3SyDUx7yHjhvM6xIBHAv8OAr5Xhi9FVo HMMtr9DvfLDOzZHyhyu1JFY= Received: (qmail 46828 invoked by alias); 16 Oct 2018 18:39:36 -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 46817 invoked by uid 89); 16 Oct 2018 18:39:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sk:perform, UD:call.c, call.c, H*r:8.14.4 X-HELO: userp2120.oracle.com Received: from userp2120.oracle.com (HELO userp2120.oracle.com) (156.151.31.85) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 Oct 2018 18:39:34 +0000 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9GIcbKk011315; Tue, 16 Oct 2018 18:39:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : cc : from : subject : message-id : date : mime-version : content-type; s=corp-2018-07-02; bh=Sx5akHP+42sBT/fNklRPQzEmnCngGUqY257D5XYNICg=; b=dZVCDnH+hsv5QUNcWctnyU5sKPdu77xAogJdP2NldzxBDrjzSecS8rPiuXM4ASmkeld6 n0voV1DL920obbN3J/tpQNKHEPUDdUc3U2FzdYsRon3PQgASh0i4xokYOu6KOVwUYs/F OIl8uT40wtj6a1OTSf5dl70Favi8OubYuBc0yl1xxKbuFucTuFKrf5aKGQfD7lB0rn5I 9diFvEbi/faBm2V9xnWR/Qlf3r7W/gs60pADuYwEoEO/SevLCRsHNsOYtgOYOBcTOrs1 lhiWID7/GUiFwHbjjeSm/12zFtvrEcY8N8vcIbQRhoOm3iQL0eVqwgn23HbVvlmfuvAB HQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2n39bragtm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Oct 2018 18:39:32 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9GIdVhS029710 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Oct 2018 18:39:31 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9GIdUO6012430; Tue, 16 Oct 2018 18:39:30 GMT Received: from [192.168.1.4] (/79.33.232.114) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 16 Oct 2018 11:39:29 -0700 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch, obvious] PR 84705 ("[6/7/8/9 Regression] internal compiler error: in add_stmt, at cp/semantics.c:390") Message-ID: Date: Tue, 16 Oct 2018 20:39:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 X-IsSubscribed: yes Hi, the main issue is already fixed in trunk - we don't ICE anymore - but I noticed that for ill-formed code like:     int i = static_cast(i); we emit a duplicate diagnostic about the incomplete type d, easy to avoid by returning error_mark_node from perform_direct_initialization_if_possible when build_special_member_call returns it. I think this latter tweak qualifies as obvious, per a comment made by Jason a while ago... Tested x86_64-linux. Thanks, Paolo. ////////////////////// /cp 2018-10-16 Paolo Carlini PR c++/84705 * call.c (perform_direct_initialization_if_possible): Early return error_mark_node if build_special_member_call returns it. /testsuite 2018-10-16 Paolo Carlini PR c++/84705 * g++.dg/cpp0x/pr84705.C: New. Index: cp/call.c =================================================================== --- cp/call.c (revision 265200) +++ cp/call.c (working copy) @@ -10995,6 +10995,8 @@ perform_direct_initialization_if_possible (tree ty expr = build_special_member_call (NULL_TREE, complete_ctor_identifier, &args, type, LOOKUP_NORMAL, complain); release_tree_vector (args); + if (expr == error_mark_node) + return error_mark_node; return build_cplus_new (type, expr, complain); } Index: testsuite/g++.dg/cpp0x/pr84705.C =================================================================== --- testsuite/g++.dg/cpp0x/pr84705.C (nonexistent) +++ testsuite/g++.dg/cpp0x/pr84705.C (working copy) @@ -0,0 +1,13 @@ +// { dg-do compile { target c++11 } } +// { dg-options "" } + +int a[]{a}; // { dg-error "invalid conversion" } + +template +struct b { + __attribute__((c([] { + struct { + int a = static_cast(a); // { dg-error "invalid use of incomplete type" } + } e; + }))); +};