[libcxxabi] r198643 - Implement demangling for user-defined operators.
richard at metafoo.co.uk
Tue Jan 7 18:46:33 PST 2014
On Tue, Jan 7, 2014 at 6:25 PM, Howard Hinnant <hhinnant at apple.com> wrote:
> On Jan 7, 2014, at 8:43 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> > It would be more correct to use "operator\"\"" here (without the trailing
> > space). This will generate an incorrect unmangled name for operator""if,
> > which can only be written without the space.
> Interesting trivia. Such a suffix can only be standard specified (lacking
> a '_' prefix). Are there any other such examples? I experimented with
> "do", "for" and "while" with no success.
On the clang side, we have a whitelist of permitted non-'_'-prefixed
suffixes. This is to avoid gratuitously breaking existing (C++98) code --
if we allowed ""foo for arbitrary foo, we'd break code where foo is defined
as a macro (expanding to a string literal). Such code is common, for things
like "%8"PRIuS. We /do/ allow arbitrary '_'-prefixed suffixes, and that
breaks code like "foo"__FILE__, but such code appears to be less common in
practice. The only keyword on our whitelist is "if".
Under GCC, the whitelist is anything starting with a lowercase letter, and
things like operator""for and operator""while work there (with a warning
that they are reserved).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-commits