The C++ Coding guidelines, Enum.3: Prefer class enums over “plain” enums contains following example:
void Print_color(int color);
enum Web_color { red = 0xFF0000, green = 0x00FF00, blue = 0x0000FF };
enum Product_info { red = 0, purple = 1, blue = 2 };
Web_color webby = Web_color::blue;
// Clearly at least one of these calls is buggy.
Print_color(webby);
Print_color(Product_info::blue);
However this example doesn't compile (see https://godbolt.org/z/vsYTKPv8x). I do understand that a scoped enum would not pollute the global namespace, and will not as readily convert to integers, but the example looks like it is trying to show some kind of redeclaration problem for red and blue?
This is also related to the related entry in AUTOSAR C++ Coding Guidelines where Rule A7-2-3 states "Enumerations shall be declared as scoped enum classes." with the rationale:
If unscoped enumeration enum is declared in a global scope, then its values can redeclare constants declared with the same identifier in the global scope. This may lead to developer’s confusion.
Using enum-class as enumeration encloses its enumerators in its inner scope and prevent redeclaring identifiers from outer scope.
Note that enum class enumerators disallow implicit conversion to numeric values.
The first statement is hard to parse (which same identifier?), but it mentions "redeclare" so what is the underlying problem here (could it be related to Redeclare variable inside enum but the first line should be "If unscoped enumeration enum is declared in a global scope class")