This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

volatile std::complex<> problem


Hi,

the following program

#include <complex>
int main()
{
  std::complex<double> c1, c2;
  volatile std::complex<double> c3(c1 + c2); // works fine
  volatile std::complex<double> c4;
  c4 = c1 + c2; // fails
}

doesn't compile with GCC 3.2.1 (and GCC 2.95.3)

Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/specs
Configured with: ./configure
Thread model: posix
gcc version 3.2.1

giving the diagnostic

volatileness.cpp: In function `int main()':
volatileness.cpp:7: passing `volatile std::complex<double>' as `this'
argument
   of `std::complex<double>& std::complex<double>::operator=(const
   std::complex<double>&)' discards qualifiers

ICC 7.0 and Kylix accept the program. Is this a well known deficiency?

Thanks,

Joerg Walter



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]