From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72507 invoked by alias); 1 Jul 2015 13:54:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 72437 invoked by uid 89); 1 Jul 2015 13:54:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 01 Jul 2015 13:54:25 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 1A7AFB8BC1; Wed, 1 Jul 2015 13:54:24 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t61DsMM6020420; Wed, 1 Jul 2015 09:54:22 -0400 Message-ID: <5593F10D.4020903@redhat.com> Date: Wed, 01 Jul 2015 13:54:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Jan Kratochvil , Yao Qi CC: gdb-patches@sourceware.org, Phil Muldoon Subject: Re: [patchv2] compile: Fix crash on cv-qualified self-reference References: <20150418172843.GA17777@host1.jankratochvil.net> <20150516132555.GB17266@host1.jankratochvil.net> <86lhf0p1hf.fsf@gmail.com> <20150701132406.GA13975@host1.jankratochvil.net> In-Reply-To: <20150701132406.GA13975@host1.jankratochvil.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-07/txt/msg00028.txt.bz2 On 07/01/2015 02:24 PM, Jan Kratochvil wrote: > I can change it that way but when you ask "isn't cleaner" then no, I think > your hack is even a bit more ugly than my ugly hack. > > There should be two virtual methods, one pure for 'switch (TYPE_CODE (type))' > and the other one checking TYPE_INSTANCE_FLAG* in superclass overriden only by > TYPE_CODE_STRUCT and TYPE_CODE_UNION (there would be no TYPE_CODE_*, though). What would be the method name? There's nothing preventing adding a new type_FOO function that takes a type pointer as parameter and hides the TYPE_CODE checks inside. From the caller's perspective, it'll be the same. Once we get to C++ and if we consider objectifying type, then converting that function to a method will be trivial. Thanks, Pedro Alves