[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gcc.dg / 20020607-1.c
blobafad78d8cb0dd722ee072dbbade5246a3c23bb9c
1 /* PR middle-end/6950
2 gcc 3.0.4 mistakenly set lhs.low to 0 at the beginning of the num_eq
3 expansion; it should use a temporary.
4 /* { dg-do run } */
6 typedef struct cpp_num cpp_num;
7 struct cpp_num
9 long high;
10 long low;
11 char overflow;
14 #define num_eq(num1, num2) (num1.low == num2.low && num1.high == num2.high)
16 static cpp_num
17 num_equality_op (lhs, rhs)
18 cpp_num lhs, rhs;
20 lhs.low = num_eq (lhs, rhs);
21 lhs.high = 0;
22 lhs.overflow = 0;
23 return lhs;
26 int main()
28 cpp_num a = { 1, 2 };
29 cpp_num b = { 3, 4 };
31 cpp_num result = num_equality_op (a, b);
32 if (result.low)
33 return 1;
35 result = num_equality_op (a, a);
36 if (!result.low)
37 return 2;
39 return 0;