https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69772
Bug ID: 69772 Summary: enum class bool comparison error Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: claytrychta at gmail dot com Target Milestone: --- The below code comparing a type of enum class bool fails to compile with this error: main.cpp: In function 'int main()': main.cpp:10:47: error: could not convert 'test' from 'Test' to 'bool' const char *p = Test::Foo == test ? "a" : "b"; enum class Test : bool { Foo, Bar }; int main() { Test test = Test::Foo; const char *p = Test::Foo == test ? "a" : "b"; (void)p; } Changing the underlying type of the enum to other types (short, int, or long) works. Also, returning other types in the ternary (such as int) works.