Skip to content

Instantly share code, notes, and snippets.

@sgkim126
Created November 16, 2015 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sgkim126/8f88008cf015af631a8a to your computer and use it in GitHub Desktop.
Save sgkim126/8f88008cf015af631a8a to your computer and use it in GitHub Desktop.
cannot implicitly convert enum class to numeric
enum class Color {
Red, Green, Blue
};
Color color = Color::Red;
switch (color) {
case 0: // error: could not convert '0' from 'int' to 'Color'
break;
case Color::Green:
break;
case Color::Blue:
break;
}
if (color) { // error: could not convert 'r' from 'Color' to 'bool'
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment