[cxx-abi-dev] need mangling for string literals and lifetime-extended temporaries used in static constexpr member initializers and for string literals in constexpr functions

Jason Merrill jason at redhat.com
Fri May 24 13:23:39 UTC 2013


On 05/24/2013 01:23 AM, Richard Smith wrote:
> So... this problem was not really new in C++11. In C++98 it can be
> witnessed for an inline function such as:
>
> inline const char *get() {
>    static const char *str = "foo";
>    return str;
> }

The ABI already deals with this case:

---

Occasionally entities in local scopes must be mangled too (e.g. because 
inlining or template compilation causes multiple translation units to 
require access to that entity). The encoding for such entities is as 
follows:

   <local-name> := Z <function encoding> E <entity name> [<discriminator>]
                := Z <function encoding> E s [<discriminator>]

   <discriminator> := _ <non-negative number>      # when number < 10
                   := __ <non-negative number> _   # when number >= 10

...
---

We just need to specify how lifetime-extended temporaries fit into this. 
  And, I suppose, that we need to use <data-member-prefix> for strings 
in the various lambda contexts.

Jason



More information about the cxx-abi-dev mailing list