C++0x: Mangling of decltype
Doug Gregor
doug.gregor at gmail.com
Wed Jul 11 13:35:47 UTC 2007
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.
- 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