From patchwork Fri Jun 13 10:20:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 359492 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 A3B01140096 for ; Fri, 13 Jun 2014 20:24:02 +1000 (EST) 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:subject:references :in-reply-to:content-type; q=dns; s=default; b=QYbv5jRQzSNKr234F AY2omsJm9N+VOHs1Fjh63uNkyMgB1nsz66z/QaxYRxorvboqc1l7LRj/CJmvHkwy 02WS/w6ipqIG6fPmNgx9ZoRVu6GA0gPBHrpL0KT8Q/qziK88ZJ0ghkM0f4L7KwFB qwcTgJYS8EV4m9ouFl9nza8hWk= 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:subject:references :in-reply-to:content-type; s=default; bh=vXVRZKP/UpYnmImYhphHV7U vpDs=; b=aEv/lt1G9NI6ahgLs9qI+kBA1cFTEZEyjlVODLEZ4VBG+E5jNbVssIe xdX5V8gQo+w2UNHhtZeiapEZdU/VVQYyVnsBe3qirOf8uHJ/xBgQSvw9aIojASg9 V8ucazA2mkASdo3qfwqd3VGs6+dSZIMTAkvzZvjMOxaSWG+1JHYA= Received: (qmail 21064 invoked by alias); 13 Jun 2014 10:23:40 -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 20898 invoked by uid 89); 13 Jun 2014 10:23:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: aserp1040.oracle.com Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 13 Jun 2014 10:23:36 +0000 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s5DANXU2026289 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 13 Jun 2014 10:23:34 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s5DANXbx019213 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Jun 2014 10:23:33 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s5DANXCF016260; Fri, 13 Jun 2014 10:23:33 GMT Received: from [192.168.1.4] (/79.52.198.93) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Jun 2014 03:23:32 -0700 Message-ID: <539AD067.2050309@oracle.com> Date: Fri, 13 Jun 2014 12:20:23 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Jason Merrill , "gcc-patches@gcc.gnu.org" Subject: Re: [C++ Patch] PR 33101 References: <5399D163.7070700@oracle.com> <5399FC15.3010101@oracle.com> <539A19B3.6000108@redhat.com> <539AC874.6050908@oracle.com> In-Reply-To: <539AC874.6050908@oracle.com> X-IsSubscribed: yes ... nope, sorry, the latter doesn't pass testing, accepts: (void = 0) and void2.C regresses. Thus I propose something conservative, like the below. Thanks, Paolo. /////////////////// Index: cp/decl.c =================================================================== --- cp/decl.c (revision 211609) +++ cp/decl.c (working copy) @@ -11139,10 +11139,22 @@ grokparms (tree parmlist, tree *parms) { if (same_type_p (type, void_type_node) && DECL_SELF_REFERENCE_P (type) - && !DECL_NAME (decl) && !result && TREE_CHAIN (parm) == void_list_node) + && !DECL_NAME (decl) && !result + && TREE_CHAIN (parm) == void_list_node) /* this is a parmlist of `(void)', which is ok. */ break; - cxx_incomplete_type_error (decl, type); + else if (typedef_variant_p (type)) + error_at (DECL_SOURCE_LOCATION (decl), + "invalid use of typedef-name for type " + "% in parameter declaration"); + else if (cv_qualified_p (type)) + error_at (DECL_SOURCE_LOCATION (decl), + "invalid use of cv-qualified type % " + "in parameter declaration"); + else + error_at (DECL_SOURCE_LOCATION (decl), + "invalid use of type % in parameter " + "declaration"); /* It's not a good idea to actually create parameters of type `void'; other parts of the compiler assume that a void type terminates the parameter list. */ Index: testsuite/g++.dg/conversion/err-recover1.C =================================================================== --- testsuite/g++.dg/conversion/err-recover1.C (revision 211609) +++ testsuite/g++.dg/conversion/err-recover1.C (working copy) @@ -1,6 +1,6 @@ // PR c++/42219 -void foo(const void); // { dg-error "incomplete|const" } +void foo(const void); // { dg-error "invalid use of cv-qualified" } void bar() { Index: testsuite/g++.dg/other/void3.C =================================================================== --- testsuite/g++.dg/other/void3.C (revision 0) +++ testsuite/g++.dg/other/void3.C (working copy) @@ -0,0 +1,4 @@ +// PR c++/33101 + +typedef void v; +typedef v (*pf)(v); // { dg-error "invalid use of typedef-name" }