more mangling substitution woes

Alex Samuel samuel at codesourcery.com
Wed May 10 06:04:20 UTC 2000


I think the new name grammar still doesn't do what we want.  Consider
for instance the example mangling of 

    void first<Duo>(/*nondependent*/Duo); 

The example notes

    (Note: first is S_, Duo is S1_, first is S2_) 

and gives as the mangling

    _Z5firstI3DuoEvS0_

I think the current grammar doesn't obtain all the substitutions we
want.  Here's the tree:

      <mangled-name>                  : void first<Duo> (Duo)
       <encoding>                     : first<Duo>
    *   <name>                        : first<Duo>
	 <unqualified-name>           : first<Duo>
	  <template-name>             : first
	   <source-name>              : first
	    <identifier>              : first
	  <template-args>             : <Duo>
    *      <type>                     : Duo
	    <class-enum-type>         : Duo
	     <unqualified-name>       : Duo
	      <source-name>           : Duo
	       <identifier>           : Duo
	   [done with <type>; S_ := Duo]
	[done with <name>; S0_ := first<Duo>]
	<bare-function-type>          : void () (Duo)
	 <type>                       : void
	 <type>                       : Duo == S_

Productions that are substitution candidates are marked with a `*'.
The template name `first' is never made a substitution candidate (if
it were not in the global namespace, it would have hit
<template-prefix>, which would have created the candidate).  

So what I think we need is something along these lines:

  - Eliminate 

      <unqualified-name> ::= <template-name> <template-args>

  - Add

      <name> ::= <unqualified-template-name> <template-args>

      <unqualifed-template-name> ::= <template-name>
                                 ::= <substitution>

That way top-level template names get substituted.




More information about the cxx-abi-dev mailing list