From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25959 invoked by alias); 9 Jun 2011 10:07:18 -0000 Received: (qmail 25922 invoked by uid 22791); 9 Jun 2011 10:07:17 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from smtp207.alice.it (HELO smtp207.alice.it) (82.57.200.103) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Jun 2011 10:07:02 +0000 Received: from [192.168.1.4] (79.43.213.74) by smtp207.alice.it (8.5.124.08) id 4DE640D500B81B83; Thu, 9 Jun 2011 12:07:01 +0200 Message-ID: <4DF09B6B.4060709@oracle.com> Date: Thu, 09 Jun 2011 11:44:00 -0000 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110414 SUSE/3.1.10 Thunderbird/3.1.10 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 29003 Content-Type: multipart/mixed; boundary="------------050105070400040704020704" X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg00722.txt.bz2 This is a multi-part message in MIME format. --------------050105070400040704020704 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 213 Hi, I tested on x86_64-linux the below patchlet for a long standing accepts-invalid. Is it ok for mainline? Or do we want a different error message? A somehow tighter check? Thanks, Paolo. ////////////////// --------------050105070400040704020704 Content-Type: text/plain; name="CL_29003" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="CL_29003" Content-length: 249 /cp 2011-06-09 Paolo Carlini PR c++/29003 * decl.c (grokdeclarator): Reject operator names in typedefs. /testsuite 2011-06-09 Paolo Carlini PR c++/29003 * g++.dg/parse/error38.C: New. --------------050105070400040704020704 Content-Type: text/plain; name="patch_29003" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch_29003" Content-length: 907 Index: testsuite/g++.dg/parse/error38.C =================================================================== --- testsuite/g++.dg/parse/error38.C (revision 0) +++ testsuite/g++.dg/parse/error38.C (revision 0) @@ -0,0 +1,3 @@ +// PR c++/29003 + +typedef int operator !(); // { dg-error "not allowed" } Index: cp/decl.c =================================================================== --- cp/decl.c (revision 174838) +++ cp/decl.c (working copy) @@ -8441,6 +8441,13 @@ grokdeclarator (const cp_declarator *declarator, return error_mark_node; } + if (dname && IDENTIFIER_OPNAME_P (dname) + && declspecs->specs[(int)ds_typedef]) + { + error ("operator name is not allowed"); + return error_mark_node; + } + /* Anything declared one level down from the top level must be one of the parameters of a function (because the body is at least two levels down). */ --------------050105070400040704020704--