[cxx-abi-dev] Mangling for noexcept operator

John McCall rjmccall at apple.com
Tue Sep 4 18:46:13 UTC 2012


On Sep 4, 2012, at 11:30 AM, David Vandevoorde wrote:
> On Sep 4, 2012, at 2:17 PM, John McCall wrote:
>> On Sep 4, 2012, at 6:39 AM, Mike Herrick wrote:
>>> We don't seem to have a mangling for the new noexcept operator.  
>>> 
>>> How's this:
>>> 
>>> <operator-name> ::= nx		# noexcept (an expression)
>>> 
>>> For example:
>>> 
>>> void f(int) noexcept;
>>> void f(float) throw (int);
>>> template <class T> auto g(T p) -> decltype((int (*)[noexcept(f(p))])0);
>>> int main() {
>>>  g(1);
>>> }
>>> 
>>> Which would provide a mangled name of: _Z1gIiEDTcvPAnxcl1ffp_E_iLi0EET_ for g.
>> 
>> This seems like a fine mangling, but it shouldn't be an <operator-name>.
>> Let's just do:
>> <expression> ::= nx <expression>
> 
> It would be odd not to follow the pattern of sizeof and alignof here, no?

Heh.  I was following the pattern of typeid and throw. :)  I didn't actually notice that sizeof and alignof are only <expression>s directly in the type variant.

> (I can kind of see an argument to distinguish the "operators" that cannot be the basis of a <base-unresolved-name>, but I'm not sure it's worth the complication.)

Well, they also can't be the names of declarations, at least until the committee inevitably adds an operator sizeof. :)

I withdraw my tweak, although I may just move these using editorial discretion unless you really object.  Neither seems inherently less complicated, and having (e.g.) both sizeof rules in the same place has some merit.

John.


More information about the cxx-abi-dev mailing list