In a C++ library used in many places in our collaboration, we have mistakenly defined multiple enums in the same lib namespace to define the constant values. An enum is a distinct type but not a distinct namespace. As a consequence all enum values end up in the same namespace. This is an open door to enum identifier collision and also inconvenient when using automatic completion. In order to solve this we are considering moving the different enums in distinct namespaces.
To easy evolution of code using this library we would like to be able to display at compile time a "deprecate" warning message suggesting the code change when the old enum identifiers are met in the code.
The following question and answers Does there exist a static_warning? provide a way to define a deprecate warning when a condition is met. How could I achieve the same effect when an enum identifier shows up in user code ?