OSDN Git Service

PR c++/38064
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 May 2010 19:01:13 +0000 (19:01 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 May 2010 19:01:13 +0000 (19:01 +0000)
* typeck.c (cp_build_binary_op): Allow enums for <> as well.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159042 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/enum3.C

index 634a74b..3f3b68e 100644 (file)
@@ -1,3 +1,8 @@
+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
index 46bc34d..e92175f 100644 (file)
@@ -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,
index 737a9f1..5b213ca 100644 (file)
@@ -1,3 +1,8 @@
+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
index 5555ab2..5ae5e1a 100644 (file)
@@ -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;
 }