[cxx-abi-dev] C++0x: Mangling of decltype

Daveed Vandevoorde daveed at edg.com
Wed Jul 11 14:03:40 UTC 2007


On Jul 11, 2007, at 9:35 AM, Doug Gregor wrote:

> Continuing the string of manglings for C++0x, I propose the following
> mangling schemes for decltype. decltype is like "typeof", and is
> described here:
>
>  http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2115.pdf
>
> There are two mangling rules:
>
>  <type> ::= Dt <expression> E  # decltype of an id-expression or
> class member access (C++0x)
>             ::= DT <expression> E  # decltype of an expression (C++0x)
>
> We need two rules because decltype behaves differently for
> id-expressions and class member accesses vs. full expressions. For
> example:
>
>  int x;
>  decltype(x) y1; // y1 has type "int"
>  decltype((x)) y2; // y2 has type "int &"
>
> A patch to the ABI document is below.


The codes look good.

However, I don't think those type entries belong in the "qualifiers  
section".  Instead, I'd introduce a new paragraph somewhere after the  
introduction of <expression>.

Also (and this is about the previous patch introducing "Dp"), I'd  
prefer the "U" entry (vendor extension) to remain the last in the  
list.  I.e., swap the Dp and U codes.

Ah, and another note regarding your previous patch: I'd change
	C++0x pack expansions are qualified with <code>Dp</code>.
to
	C++0x pack expansions are prefixed with <code>Dp</code>.


Thanks,

	Daveed


>  - Doug
>
> diff -u orig/abi-mangling.html ./abi-mangling.html
> --- orig/abi-mangling.html	2007-07-11 09:21:46.000000000 -0400
> +++ ./abi-mangling.html	2007-07-11 09:28:02.000000000 -0400
> @@ -50,6 +50,8 @@
> <tr><td>oper</td> <td>d</td> <td> v </td> <td> Operator / </td> </tr>
> <tr><td>oper</td> <td>d</td> <td> V </td> <td> Operator /= </td> </tr>
> <tr><td>type</td> <td>D</td> <td> p </td> <td> pack expansion of
> (C++0x) </td> </tr>
> +<tr><td>type</td> <td>D</td> <td> t </td> <td> decltype of an
> id-expression or class member access (C++0x) </td> </tr>
> +<tr><td>type</td> <td>D</td> <td> T </td> <td> decltype of an
> expression (C++0x) </td> </tr>
> <tr><td>obj </td> <td>D</td> <td> 0 </td> <td> Deleting destructor</ 
> td> </tr>
> <tr><td>obj </td> <td>D</td> <td> 1 </td> <td> Complete object
> (in-charge) destructor</td> </tr>
> <tr><td>obj </td> <td>D</td> <td> 2 </td> <td> Base object
> (not-in-charge) destructor</td> </tr>
> diff -u orig/abi.html ./abi.html
> --- orig/abi.html	2007-07-11 09:21:41.000000000 -0400
> +++ ./abi.html	2007-07-11 09:27:23.000000000 -0400
> @@ -4156,6 +4156,8 @@
> 	 ::= G <type>	# imaginary (C 2000)
> 	 ::= U <source-name> <type>	# vendor extended type  
> qualifier
>          ::= Dp <type>  # pack expansion of (C++0x)
> +         ::= Dt <expression> E  # decltype of an id-expression
> or class member access (C++0x)
> +         ::= DT <expression> E  # decltype of an expression  
> (C++0x)
>   <CV-qualifiers> ::= [r] [V] [K] 	# restrict (C99),  
> volatile, const
>
> </pre></font></code>
>




More information about the cxx-abi-dev mailing list