Bug 48107

Summary: [C++0x] no explicit conversion from scoped enumeration type to bool
Product: gcc Reporter: Jonathan Wakely <redi>
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Severity: normal CC: jason
Priority: P3 Keywords: rejects-valid
Version: 4.4.5   
Target Milestone: 4.6.1   
Host: Target:
Build: Known to work:
Known to fail: 4.4.6, 4.5.3, 4.6.0 Last reconfirmed:

Description Jonathan Wakely 2011-03-13 21:59:04 UTC
4.4, 4.5 and 4.6 all reject this code

enum class E { };

void f(E e) {

e.C:4: error: invalid operands of types ‘E’ and ‘int’ to binary ‘operator!=’
Comment 1 Jason Merrill 2011-04-08 15:14:57 UTC
Fixed by r172138

        PR c++/48450
        * c-family/c-common.c (c_common_truthvalue_conversion): Don't ignore
        conversion from C++0x scoped enum.
        * cp/cvt.c (ocp_convert): Handle converting scoped enum to bool.
Comment 2 Jonathan Wakely 2011-04-08 15:16:58 UTC
excellent, thanks!