Patchwork C++ PATCH for c++/48369 (ICE with isnan)

login
register
mail settings
Submitter Jason Merrill
Date March 30, 2011, 7:50 p.m.
Message ID <4D93896A.7010809@redhat.com>
Download mbox | patch
Permalink /patch/88955/
State New
Headers show

Comments

Jason Merrill - March 30, 2011, 7:50 p.m.
A couple of missed cases.

Tested x86_64-pc-linux-gnu, applying to trunk and 4.6.
commit cea17025eb232f3931ce34e16dedff7fd42d2478
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Mar 30 15:17:27 2011 -0400

    	PR c++/48369
    	* semantics.c (potential_constant_expression_1): Handle
    	UNORDERED_EXPR and ORDERED_EXPR.

Patch

diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index b88e190..48dd4ee 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -7741,6 +7741,8 @@  potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
     case BIT_XOR_EXPR:
     case BIT_AND_EXPR:
     case TRUTH_XOR_EXPR:
+    case UNORDERED_EXPR:
+    case ORDERED_EXPR:
     case UNLT_EXPR:
     case UNLE_EXPR:
     case UNGT_EXPR:
diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/isnan.C b/gcc/testsuite/g++.dg/cpp0x/regress/isnan.C
new file mode 100644
index 0000000..40d07e5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/regress/isnan.C
@@ -0,0 +1,9 @@ 
+// PR c++/48369
+// { dg-options -std=gnu++0x }
+
+extern "C" int isnan (double);
+
+void f(double d)
+{
+    bool b = isnan(d);
+}