== Why is this an issue?

Since {cpp}11, it's possible to declare the underlying type of an ``++enum++``, and like any type declaration, ``++enum++`` declarations can contain the ``++const++`` or ``++volatile++`` specifier. But because ``++enum++`` values are named constants and cannot be re-assigned, those specifiers are ignored by the compiler and are therefore useless.


This rule raises an issue if ``++const++`` or ``++volatile++`` is present in the declaration of the underlying type of an ``++enum++``.


=== Noncompliant code example

[source,cpp,diff-id=1,diff-type=noncompliant]
----
enum class Color : const long int {  // Noncompliant: Remove this "const" specifier.
  Red   = 0xff0000,
  Green = 0x00ff00,
  Blue  = 0x0000ff
};

enum class Size : volatile char {  // Noncompliant: Remove this "volatile" specifier.
  Small   = 's',
  Big     = 'b'
};
----


=== Compliant solution

[source,cpp,diff-id=1,diff-type=compliant]
----
enum class Color : long int {
  Red   = 0xff0000,
  Green = 0x00ff00,
  Blue  = 0x0000ff
};

enum class Size : char {
  Small   = 's',
  Big     = 'b'
};
----



ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Remove this "[const|volatile]" specifier.


=== Highlighting

``++const++`` or ``++volatile++`` keyword


'''
== Comments And Links
(visible only on this page)

=== on 17 Jun 2016, 09:49:24 Ann Campbell wrote:
\[~alban.auzeill], shouldn't the enums in the code samples be declared with ``++class++`` or ``++struct++``?

=== on 17 Jun 2016, 11:01:23 Alban Auzeill wrote:
\[~ann.campbell.2] Of course. But I wrote this rule before [RSPEC-3642], that's why I didn't comply with it.

Perhaps, we should export all our Noncompliant/Compliant examples to a project analysed by our {cpp} plugin, so that we can enforce new rules on previous examples.

endif::env-github,rspecator-view[]
