From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6081 invoked by alias); 25 Jul 2014 09:16:41 -0000 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 Received: (qmail 6060 invoked by uid 89); 25 Jul 2014 09:16:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 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; Fri, 25 Jul 2014 09:16:40 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6P9Gbm9018971 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Jul 2014 05:16:38 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6P9GZV1018616; Fri, 25 Jul 2014 05:16:35 -0400 Message-ID: <53D22072.4000200@redhat.com> Date: Fri, 25 Jul 2014 09:55:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Cary Coutant , Jason Merrill CC: gcc-patches Subject: Re: [PATCH 2/3] PR other/61321 - demangler crash on casts in template parameters References: <1401191856-27585-1-git-send-email-palves@redhat.com> <1401191856-27585-3-git-send-email-palves@redhat.com> <538C7F4F.4050800@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-07/txt/msg01722.txt.bz2 On 07/24/2014 11:35 PM, Cary Coutant wrote: >> It seems that the problem here is more general; a template argument list is >> not in scope within that same template argument list. Can't we fix that >> without special-casing conversion ops? > > I think conversion ops really are a special case. Thanks Cary. FWIW, I agree. (GDB 7.8 hasn't been released yet, though it's close. If this patch is approved as is, we'll be able to have the crash fixed there. If this requires a significant rewrite though, I'm afraid I might not be able to do it myself anytime soon.) > It's the only case > where the template parameters refer to the template argument list from > the cast operator's enclosing template. In a cast expression, like > anywhere else you might have a template parameter, the template > parameter refers to the template argument list of the immediately > enclosing template. > > I think this note from Section 5.1.3 (Operator Encodings) of the ABI > is what makes this a special case (it's an informative comment in the > document, but seems to me to be normative): > > "For a user-defined conversion operator the result type (i.e., the > type to which the operator converts) is part of the mangled name of > the function. If the conversion operator is a member template, the > result type will appear before the template parameters. There may be > forward references in the result type to the template parameters." > -- Thanks, Pedro Alves