]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/46304 (g++ crashes with ICE in bitmap_first_set_bit, at bitmap.c:770)
authorJason Merrill <jason@redhat.com>
Wed, 20 Apr 2011 06:31:07 +0000 (02:31 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 20 Apr 2011 06:31:07 +0000 (02:31 -0400)
PR c++/46304
* typeck.c (cp_build_binary_op): Fold COMPLEX_EXPR.

From-SVN: r172755

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/complex7.C [new file with mode: 0644]

index d7cd00707ad0e91678aef720375383ed6b41aaba..2441d6522b2fe8b375676426b97b52a2bbfdeb84 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-19  Jason Merrill  <jason@redhat.com>
+
+       PR c++/46304
+       * typeck.c (cp_build_binary_op): Fold COMPLEX_EXPR.
+
 2011-04-19  Jason Merrill  <jason@redhat.com>
 
        PR c++/45267
index 9d4dc5a33bd5e4fa13a038cd4a75de9d165f8812..8ccb32d93c510da329e6976c90da7f5505f8b91f 100644 (file)
@@ -4328,7 +4328,11 @@ cp_build_binary_op (location_t location,
                  gcc_unreachable();
                }
            }
-         return build2 (COMPLEX_EXPR, result_type, real, imag);
+         real = fold_if_not_in_template (real);
+         imag = fold_if_not_in_template (imag);
+         result = build2 (COMPLEX_EXPR, result_type, real, imag);
+         result = fold_if_not_in_template (result);
+         return result;
        }
 
       /* For certain operations (which identify themselves by shorten != 0)
index 7ac925410bfcfc6e31ed9413e80f39ca38a6eecb..253c8321769a32e8e8e725f55f7de268471b39f3 100644 (file)
@@ -1,3 +1,7 @@
+2011-04-19  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/ext/complex7.C: New.
+
 2011-04-19  Jason Merrill  <jason@redhat.com>
 
        * g++.dg/ext/attrib41.C: New.
diff --git a/gcc/testsuite/g++.dg/ext/complex7.C b/gcc/testsuite/g++.dg/ext/complex7.C
new file mode 100644 (file)
index 0000000..9d5463f
--- /dev/null
@@ -0,0 +1,6 @@
+// { dg-options "" }
+
+class A
+{
+  static const _Complex double x = 1.0 + 2.0i;
+};