-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Description
I notice that the mangling of new-expressions is specified as
::= [gs] nw <expression>* _ <type> E # new (expr-list) type ::= [gs] nw <expression>* _ <type> <initializer> # new (expr-list) type (init) ::= [gs] na <expression>* _ <type> E # new[] (expr-list) type ::= [gs] na <expression>* _ <type> <initializer> # new[] (expr-list) type (init)
The new[] mangling doesn't clarify how the length of the array allocation is encoded. GCC encodes it into the type by building an array type; Clang seems to not encode it at all. So, for
template <unsigned> struct A { };
template<typename T>
auto foo() -> A<sizeof(new T[42])>
{ return {}; }
int main() { foo<int>(); }
GCC mangles foo as _Z3fooIiE1AIXszna_A42_T_EEEv,
Clang as _Z3fooIiE1AIXszna_T_EEEv
Any objection to clarifying that the GCC mangling is correct?
RokerHRO
Metadata
Metadata
Assignees
Labels
No labels