Is it possible to alias an enum-class enumerator?

Enumerators in using-declarations

The problem is that the standard says that you shall not refer to an enumerator inside an enum class when using specifying a using-declaration.

7.3.3p7 The using declaration [namespace.udecl] (n3337)

A using-declaration shall not name a scoped enumerator.

namespace N {
  enum class E { A };
}

using N::E;    // legal
using N::E::A; // ill-formed, violation of [namespace.udecl]p7

Note: clang does accept both lines above; here's a relevant bug report.

It's perfectly fine to refer to the actual name of the enum class itself, but trying to refer to one of its enumerators is ill-formed.


Enumerators in alias-declarations

The standard says that an alias-declaration can only be used to refer to a type-name, since an enumerator isn't a type, using one in such context is ill-formed.

namespace N {
  enum class E { A };
}

using x = N::E;     // legal, `N::E` is a type
using y = N::E::A;  // ill-formed, `N::E::A` isn't a type

Alternatives to using- and alias-declarations

You could declare a constant having whatever-name-of-your-choice initialized with the value you'd like to "alias":

namespace N {
  enum class E { A };
}

constexpr N::E x = N::E::A;
int main () {
  N::E value = x; // semantically equivalent of `value = N::E::A`
}

Sort of:

namespace long_and_ugly {
    enum class colour
    {
        red,
        green,
        blue
    };
}
const colour red = long_and_ugly::colour::red;