It is possible to write a library solution for combining two enums:

https://godbolt.org/z/n6336ddqj

The code provides a generic EnumUnion template to offer a class standing in for either enum with implicit conversion.

 

(disclaimer: I specified parts of it, and let me help by LLM to fill out the rest)
 

-----Ursprüngliche Nachricht-----
Von: Rainer Deyke via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Sa 30.05.2026 12:07
Betreff: Re: [std-proposals] D0000R0: Extensible Scoped Enumerations (draft)
An: std-proposals@lists.isocpp.org;
CC: Rainer Deyke <rainerd@eldwood.com>;
On 5/29/26 20:32, Andrey Fokin via Std-Proposals wrote:
> D0000R0: Extensible Scoped Enumerations (draft)
> Author: Andrey Fokin lazzyfox@gmail.com
> Date: 2026-04-20
>
> Hello all,
>
> I am submitting a draft proposal for review:
>
>      PDF:
> https://github.com/lazzyfox/wg21/blob/main/docs/D0000R0-ExtensibleScopedEnumerations.pdf

Enum inheritance is an obvious extension to C++.  The real question is
if it's useful enough to justify adding to the language.  The lesser
question is what to do about the edge cases, but most of the edge cases
go away if you just stick to single inheritance.

#define SOME_TEXT_HERE a, b, c
#define SOME_MORE_TEXT_HERE d, e

enum class x { SOME_TEXT_HERE };
enum class y { SOME_TEXT_HERE, SOME_MORE_TEXT_HERE };
enum class z : x { SOME_MORE_TEXT_HERE };
// Enum z is defined as if it were enum y,
// but allow implicit conversion from x to z.

The requirement that enum values not conflict is nonsensical:

// This is legal right now:
enum class binary_digits : std::uint8_t {
  zero = 0,
  nada = 0,
  null = 0,
  one = 1,
  eins = 1,
};

// This would not be, and we don't even have multiple inheritance.
enum class trinary_digits : binary_digits {
  three = 3,
  drei = 3,
};

The real edge case for multiple inheritance is this:

enum class x { a = 10 };
enum class y { b = 12 };
enum class x_plus_c : x { c }; // c has a value of 11
enum class y_plus_c : y { c }; // f has a value of 13
enum class x_plus_y_plus_c : x, y { c }; // What's the value of c now?


--
Rainer Deyke - rainerd@eldwood.com
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals