blob: 789558a0d85259422e1f880113440b0124897f1d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
Upstream-Status: Inappropriate [Backport]
From 021acee3b7a6b26783c92870c1e202730c3f024e Mon Sep 17 00:00:00 2001
From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
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
|