http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50957

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |wrong-code
   Last reconfirmed|                            |2011-11-02
          Component|libstdc++                   |c++
                 CC|                            |jason at gcc dot gnu.org
     Ever Confirmed|0                           |1
            Summary|complex<T> ctor drops sign  |[C++0x][constexpr]
                   |of zero (sometimes)         |complex<T> ctor drops sign
                   |                            |of zero (sometimes)
      Known to fail|                            |4.6.2

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-02 
09:36:44 UTC ---
Confirmed.  Looks like a frontend issue (probably related to constexpr?).
In .initial we have

{
  struct mock_complex z1 = {._M_real=-0.0, ._M_imag=1.0e+0};
  struct complex z2 = {._M_value=__complex__ (0.0, 1.0e+0)};

  <<cleanup_point   struct mock_complex z1 = {._M_real=-0.0,
._M_imag=1.0e+0};>>;

thus z2 is already initialized from a bogus value.  Without -std=c++0x we have

  struct complex z2;
  <<cleanup_point <<< Unknown tree: expr_stmt
  std::complex<double>::complex (&z2, -0.0, 1.0e+0) >>>>>;

which is correct.

Reply via email to