Commit b5c0a77e by Jason Merrill Committed by Jason Merrill

re PR c++/38064 ([c++0x] operator== doesn't work for enum classes)

	PR c++/38064
	* typeck.c (cp_build_binary_op): Allow enums for <> as well.

From-SVN: r159042
parent 13917ae3
2010-05-04 Jason Merrill <jason@redhat.com>
PR c++/38064
* typeck.c (cp_build_binary_op): Allow enums for <> as well.
2010-05-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/43705
......
......@@ -4174,8 +4174,10 @@ cp_build_binary_op (location_t location,
}
build_type = boolean_type_node;
if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE)
&& (code1 == INTEGER_TYPE || code1 == REAL_TYPE))
if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE
|| code0 == ENUMERAL_TYPE)
&& (code1 == INTEGER_TYPE || code1 == REAL_TYPE
|| code1 == ENUMERAL_TYPE))
short_compare = 1;
else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
result_type = composite_pointer_type (type0, type1, op0, op1,
......
2010-05-04 Jason Merrill <jason@redhat.com>
PR c++/38064
* g++.dg/cpp0x/enum3.C: Extend.
2010-05-04 H.J. Lu <hongjiu.lu@intel.com>
PR target/43799
......
......@@ -14,4 +14,14 @@ int main()
E e = E::elem;
if (!f (e == E::elem))
return 1;
if (!f (e <= E::elem))
return 1;
if (!f (e >= E::elem))
return 1;
if (f (e < E::elem))
return 1;
if (f (e > E::elem))
return 1;
if (f (e != E::elem))
return 1;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment