From patchwork Fri Apr 27 09:33:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 905563 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-476895-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="dhETAx3a"; 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 40XTKJ0LWvz9s2L for ; Fri, 27 Apr 2018 19:34:07 +1000 (AEST) 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=yGLCkMQ5PJ/938uA+k0ziAY7nwPwA2qeD9OT5+TTLu/OkXksJf LG/fjHlRdXJZOwfq+oEOzvky7eKyhytlMTrsBI2TvNtRvA1yKeg016NZChjYvy0i wI7JbRaHJjtSy6EyTP/HKecAQ8epbZdLJiB5h+6nfdOwm63fiHkusxC8E= 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=Bx3SutJK3p1tcefSZ9CogJ/tMmI=; b=dhETAx3a1ZSrwy2pzX+5 nng0PjVrrRoh/JjyMY5Oiiz0MLffKZGNQ/Axd1IgAsb1DaAmXXDbw7+KxvQ3jh5b KF8aFKqvORzl6USkSZSThrAZR3FBK8d0hMUhglkRyRQcDMKjxhjWfXcoXcZZRfNs I7NTWGVXljjTkoGAK1eESdI= Received: (qmail 79189 invoked by alias); 27 Apr 2018 09:34:00 -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 79156 invoked by uid 89); 27 Apr 2018 09:33:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=remained, UD:oracle.com, sk:paoloc, errorrecovery X-HELO: aserp2130.oracle.com Received: from aserp2130.oracle.com (HELO aserp2130.oracle.com) (141.146.126.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Apr 2018 09:33:57 +0000 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w3R9Qtwq124022; Fri, 27 Apr 2018 09:33:55 GMT Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2hfttyeu4c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 27 Apr 2018 09:33:55 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w3R9Xser003225 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 27 Apr 2018 09:33:54 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w3R9XrTD014453; Fri, 27 Apr 2018 09:33:53 GMT Received: from [192.168.1.4] (/79.35.214.23) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 27 Apr 2018 02:33:52 -0700 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 84691 ("[6/7/8/9 Regression] internal compiler error: in poplevel_class...") Message-ID: Date: Fri, 27 Apr 2018 11:33:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8875 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804270094 X-IsSubscribed: yes Hi, this small error-recovery issue remained in my todo list of 8 regressions: just clear the friendp flag in this case too - like we do a few lines above for virtual declarations - and avoid problems later. Tested x86_64-linux. Thanks, Paolo. //////////////// /cp 2018-04-27 Paolo Carlini PR c++/84691 * decl.c (grokdeclarator): Clear friendp upon definition in local class definition error. /testsuite 2018-04-27 Paolo Carlini PR c++/84691 * g++.dg/cpp0x/friend3.C: New. Index: cp/decl.c =================================================================== --- cp/decl.c (revision 259697) +++ cp/decl.c (working copy) @@ -11298,9 +11298,11 @@ grokdeclarator (const cp_declarator *declarator, if (decl_context == NORMAL) error ("friend declaration not in class definition"); if (current_function_decl && funcdef_flag) - error ("can%'t define friend function %qs in a local " - "class definition", - name); + { + error ("can%'t define friend function %qs in a local " + "class definition", name); + friendp = 0; + } } else if (ctype && sfk == sfk_conversion) { Index: testsuite/g++.dg/cpp0x/friend3.C =================================================================== --- testsuite/g++.dg/cpp0x/friend3.C (nonexistent) +++ testsuite/g++.dg/cpp0x/friend3.C (working copy) @@ -0,0 +1,11 @@ +// PR c++/84691 +// { dg-do compile { target c++11 } } + +template +struct a { + unsigned b = [] { + union { + friend void c() {} // { dg-error "local class" } + }; // { dg-error "no members" } + }; +};