Upstream-Status: Inappropriate [Backport] From 021acee3b7a6b26783c92870c1e202730c3f024e Mon Sep 17 00:00:00 2001 From: jason Date: Wed, 20 Apr 2011 06:31:51 +0000 Subject: [PATCH 151/200] PR c++/46304 * typeck.c (cp_build_binary_op): Fold COMPLEX_EXPR. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@172756 138bc75d-0d04-0410-961f-82ee72b054a4 index ec9233d..dec0680 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4354,7 +4354,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) new file mode 100644 index 0000000..9d5463f --- /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; +}; -- 1.7.0.4