# Extra Clang Tools 22.1.2 documentation

## clang-tidy - cppcoreguidelines-use-enum-class

# cppcoreguidelines-use-enum-class

Finds unscoped (non-class) `enum` declarations and suggests using `enum class` instead.

This check implements Enum.3 from the C++ Core Guidelines.”

Example:

    enum E {};        // use "enum class E {};" instead
    enum class E {};  // OK

    struct S {
        enum E {};    // use "enum class E {};" instead
                      // OK with option IgnoreUnscopedEnumsInClasses
    };

    namespace N {
        enum E {};    // use "enum class E {};" instead
    }

## Options

IgnoreUnscopedEnumsInClasses

  When true, ignores unscoped `enum` declarations in classes. Default is false.