From: Jason Merrill Date: Wed, 20 Apr 2011 06:30:41 +0000 (-0400) Subject: re PR c++/46304 (g++ crashes with ICE in bitmap_first_set_bit, at bitmap.c:770) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=68a29e1cf46e63f8a50a8548287d93207bc04c34;p=gcc.git re PR c++/46304 (g++ crashes with ICE in bitmap_first_set_bit, at bitmap.c:770) PR c++/46304 * typeck.c (cp_build_binary_op): Fold COMPLEX_EXPR. From-SVN: r172754 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7feb4279565..c7068ab97cc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-04-19 Jason Merrill + PR c++/46304 + * typeck.c (cp_build_binary_op): Fold COMPLEX_EXPR. + PR c++/45267 * decl.c (duplicate_decls): Keep always_inline attribute in sync with DECL_DISREGARD_INLINE_LIMITS. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 89d3247db34..dcdc79084d0 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4357,7 +4357,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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7e5d187a192..84c9d7c1bb1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-04-19 Jason Merrill + * g++.dg/ext/complex7.C: New. + * g++.dg/ext/attrib41.C: New. 2011-04-19 Kaz Kojima diff --git a/gcc/testsuite/g++.dg/ext/complex7.C b/gcc/testsuite/g++.dg/ext/complex7.C new file mode 100644 index 00000000000..9d5463f94dc --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/complex7.C @@ -0,0 +1,6 @@ +// { dg-options "" } + +class A +{ + static const _Complex double x = 1.0 + 2.0i; +};