For the following simple program
--------------------
#include <complex>
int main () {
std::complex<double> x;
x = std::complex<double>(1,0);
}
--------------------
I get this warning since 3.2:
g/x> /home/bangerth/bin/gcc-4*/bin/c++ -c x.cc -Wsynth
x.cc: In function `int main()':
x.cc:5: warning: using synthesized 'std::complex<double>&
std::complex<double>::operator=(const std::complex<double>&)' for copy
assignment
/home/bangerth/bin/gcc-4.0-pre/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/complex:1193:
warning: where cfront would use 'std::complex<double>&
std::complex<double>::operator=(const std::complex<_Tp>&) [with _Tp = double]'
This is a regression against 2.95, in which no such warning was given. The
warning is annoying since one can't really use <complex> with -Werror.
I see two ways around this annoying mis-feature: either -Wsynth shouldn't
report anything for system/libstdc++ headers, or (my preference) libstdc++
gets fixed up by adding the copy operator. The latter would clearly
be allowed by the as-if rule.
W.
--
Summary: [3.3/3.4/4.0 regression] -Wsynth warning in <complex>
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bangerth at dealii dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18644