Skip to content

Mangling for unnamed enumerations with an enumerator name for linkage purposes (P2115) #205

@wreien

Description

@wreien

P2115R0 gave unnamed enumerations that don't already have a typedef name for linkage purposes the name of their first enumerator for linkage purposes. From https://eel.is/c++draft/dcl.enum#12:

An unnamed enumeration that does not have a typedef name for linkage purposes ([dcl.typedef]) and that has a first enumerator is denoted, for linkage purposes ([basic.link]), by its underlying type and its first enumerator; such an enumeration is said to have an enumerator as a name for linkage purposes.

To mangle both the underlying type and the name of an enum requires a new production. To be able to continue to differentiate an unnamed enum, I propose something like the following (in a similar manner to closure type productions):

<unnamed-type-name> ::= <unnamed-enum-name>

<unnamed-enum-name> ::= Ue <underlying type> <enumerator source-name>

So, for instance, the types of the following enums would be mangled as follows:

enum { A };  // Uej1A, assuming underlying type is unsigned int
enum : long long { foo, bar };  // Uex3foo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions