This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH 2/3] PR other/61321 - demangler crash on casts in template parameters
- From: Pedro Alves <palves at redhat dot com>
- To: Cary Coutant <ccoutant at google dot com>, Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 25 Jul 2014 10:16:34 +0100
- Subject: Re: [PATCH 2/3] PR other/61321 - demangler crash on casts in template parameters
- Authentication-results: sourceware.org; auth=none
- References: <1401191856-27585-1-git-send-email-palves at redhat dot com> <1401191856-27585-3-git-send-email-palves at redhat dot com> <538C7F4F dot 4050800 at redhat dot com> <CAHACq4oTMguPzkYC20-WUt4JitTnVz2DnSnW1c-B9Jase0Yb8A at mail dot gmail dot com>
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."