Farid Zaripov wrote:
The 26.valarray.cassign.cpp test expect that UserClass type
provides +, -, *, / operations. But these operations are not
defined in rw_value.h.
HP aCC and Intel C++ compile the code but I did notice some
errors from gcc yesterday, and I see Sun C++ has trouble with
the code as well. I tend to trust Intel C++ over the other
compilers, so I wonder if the reasons for the error are
actually compiler bugs. Otherwise there's a bug in Intel
C++ (and HP aCC), or we're relying on some extension. What's
your take on it?
Martin
The patch below defines them and also deletes res_array.
Index: 26.valarray.cassign.cpp
===================================================================
--- 26.valarray.cassign.cpp (revision 560134)
+++ 26.valarray.cassign.cpp (working copy)
@@ -240,6 +240,19 @@
int value (const UserClass &val) { return val.data_.val_; }
+#define USERCLASS_OPERATOR(op)
\
+inline UserClass operator##op (const UserClass& __x, const UserClass&
__y) \
+{
\
+ UserClass __tmp (__x);
\
+ __tmp op##= __y;
\
+ return __tmp;
\
+} typedef void rw_unused_typedef
+
+USERCLASS_OPERATOR (+);
+USERCLASS_OPERATOR (-);
+USERCLASS_OPERATOR (*);
+USERCLASS_OPERATOR (/);
+
/***********************************************************************
***/
template <class T>
@@ -332,6 +345,7 @@
delete_array (lhs_array, nelems);
delete_array (rhs_array, nelems);
+ delete_array (res_array, nelems);
std::free (fname);
}
Farid.