This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug c++/12793] New: Can't make static_cast from std::complex<double> to std::complex<float> in 3.3.1


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Can't make static_cast from std::complex<double> to
                    std::complex<float> in 3.3.1
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sarin at mit dot edu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: 3.3.1

Hi

The following code doesn't compile with g++ 3.3.1 (it did compile with older g++ 
2.9.6):

#include <iostream>
#include <complex>
using namespace std;

int main(int argc,char *argv[])
{
  std::complex<float> cfpvar(0.08,0.08);
  std::complex<double> cdfpvar(1.11,1.11);
  cout << "cfpvar=" << cfpvar << endl;
  cout << "cdfpvar=" << cdfpvar << endl;
  cfpvar = static_cast<std::complex<float> >(cdfpvar); // g++ 3.3.1 wont compile
  cout << "cdfpvar=" << cdfpvar << endl;
  exit(0);
}

g++ -v test.cc
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib 
--with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info 
--enable-shared --enable-threads=posix --disable-checking --enable-long-long 
--enable-__cxa_atexit --enable-languages=c,c++,ada,f77,objc,java,pascal 
--host=i586-mandrake-linux-gnu --with-system-zlib
Thread model: posix
gcc version 3.3.1 (Mandrake Linux 9.2 3.3.1-2mdk)
 /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/cc1plus -quiet -v -D__GNUC__=3 
-D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=1 -D_GNU_SOURCE test.cc -D__GNUG__=3 
-quiet -dumpbase test.cc -auxbase test -version -o /tmp/ccKkUYld.s
GNU C++ version 3.3.1 (Mandrake Linux 9.2 3.3.1-2mdk) (i586-mandrake-linux-gnu)
        compiled by GNU C version 3.3.1 (Mandrake Linux 9.2 3.3.1-2mdk).
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64328
ignoring nonexistent directory "/usr/i586-mandrake-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/3.3.1
 /usr/include/c++/3.3.1/i586-mandrake-linux-gnu
 /usr/include/c++/3.3.1/backward
 /usr/local/include
 /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/include
 /usr/include
End of search list.
test.cc: In function `int main(int, char**)':
test.cc:11: error: invalid static_cast from type `std::complex<double>' to type 
`std::complex<float>'


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