Skip to content

Disabling implicit conversion of enum class -> int #1841

Description

@PazerOP

It seems this feature was added based on #391 and #984, but I personally consider this a bug: the entire purpose of enum class is to prevent any kind of implicit casting. If I wanted to format it as an integer, I should be forced to cast it to an integer or create my own formatter. Is there any recommended way to disable this? Perhaps a preprocessor option?

I have a custom formatter for some specific enum classes, but this implicit casting prevents me from being able to safely forward declare any of my enum classes, since if the custom formatter doesn't get included, format falls back to the default enum class -> int conversion. My formatter uses unique formatting specifiers that don't match anything found with the default int formatter, so when the wrong formatter is used a format_error is thrown.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions