complex u = u * v

Peter Tamburello tamburel@cdfsga.fnal.gov
Wed Jun 21 11:45:00 GMT 2000


Dear gcc-bugs:

Using gcc version 2.95.2 and libstdc++-2.90.8 on an i686-pc-linux-gnu,  
compiling the file shown here

  > cat foo.cc
  #include <complex>
  using std::complex;
  main() {
    complex<double> u(1.,2.);
    complex<double> v(3.,4.);
    u = u * v;
  }

produces the following

  > g++ foo.cc 
  /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-v3/bits/std_complex.h: In method `class complex<double> & complex<double>::operator *=<double>(const complex<double> &)':
  /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-v3/bits/std_complex.h:851:   instantiated from `operator *<double>(const complex<double> &, const complex<double> &)'
  foo.cc:6:   instantiated from here
  /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-v3/bits/std_complex.h:663: Internal compiler error.
  /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-v3/bits/std_complex.h:663: Please submit a full bug report.
  /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-v3/bits/std_complex.h:663: See <URL: http://www.gnu.org/software/gcc/faq.html#bugreport > for instructions.

The output of g++ -E is 2736 lines.  Here they are:


# 1 "foo.cc"
# 1 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-v3/complex" 1 3

# 1 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-v3/bits/std_complex.h" 1 3
 

 
 
 
 
 
 
 

 
 
 
 

 
 
 
 

 
 
 
 
 
 
 
 

 
 
 
 
 
 




# 1 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-v3/bits/c++config.h" 1 3
 

 
 
 
 
 
 
 

 
 
 
 

 
 
 
 

 
 
 
 
 
 
 
 




 


 
 
 
 


 
 


 
 
 
 
 
 
 
 

 
 

 








 
 

 


 
 
 
 
 


 
 

 
 
 
 
 

 
 
 


 


 


 


 


 


 
 

 


 


 


 


 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 


 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 


 


 


 


 


 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 


 


 


 
 

 
 

 


 


 


 


 


 


 


 


 


 


 


 


 


 
 

 


 
 

 
 

 
 

 
 

 
 

 


 


 


 


 


 


 


 


 


 


 


 


 


 
 

 


 


 
 

 
 

 
 

 


 
 

 
 

 


 
 

 
 

 


 


 


 
 
 
 















































































































































# 40 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-v3/bits/std_complex.h" 2 3

# 1 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-v3/bits/std_iosfwd.h" 1 3
 

 
 
 
 
 
 
 

 
 
 
 

 
 
 
 

 
 
 
 
 
 
 
 

 
 
 





# 1 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-v3/bits/std_cwchar.h" 1 3
 

 
 
 
 
 
 
 

 
 
 
 

 
 
 
 

 
 
 
 
 
 
 
 

 
 
 

 






 
# 1 "/usr/include/wchar.h" 1 3
 

















 







# 1 "/usr/include/features.h" 1 3
 





















 















































 













 





 



 







 
# 117 "/usr/include/features.h" 3


 









 



















































 








 












 

# 1 "/usr/include/sys/cdefs.h" 1 3
 




















# 1 "/usr/include/features.h" 1 3
 

















# 222 "/usr/include/features.h" 3

# 22 "/usr/include/sys/cdefs.h" 2 3


 







# 54 "/usr/include/sys/cdefs.h" 3


 







 



# 86 "/usr/include/sys/cdefs.h" 3



 








 







# 205 "/usr/include/features.h" 2 3



 

 








# 1 "/usr/include/gnu/stubs.h" 1 3
 





























# 219 "/usr/include/features.h" 2 3




# 27 "/usr/include/wchar.h" 2 3


extern "C" { 

 




# 1 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/include/stddef.h" 1 3






 


# 19 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/include/stddef.h" 3



 


 





 


# 61 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/include/stddef.h" 3


 





 


















 





 

 

# 131 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/include/stddef.h" 3


 

 


































typedef unsigned int size_t;






















 




 





























 



















































typedef unsigned int  wint_t;




 

 

# 317 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/include/stddef.h" 3




 





















# 36 "/usr/include/wchar.h" 2 3



 











 
typedef struct
{
  int count;		 
  wint_t value;		 
} mbstate_t;









 
extern wchar_t *wcscpy  (wchar_t *__dest, __const wchar_t *__src)  ;
 
extern wchar_t *wcsncpy  (wchar_t *__dest, __const wchar_t *__src,
			      size_t __n)  ;

 
extern wchar_t *wcscat  (wchar_t *__dest, __const wchar_t *__src)  ;
 
extern wchar_t *wcsncat  (wchar_t *__dest, __const wchar_t *__src,
			      size_t __n)  ;

 
extern int wcscmp  (__const wchar_t *__s1, __const wchar_t *__s2)  ;
 
extern int wcsncmp  (__const wchar_t *__s1, __const wchar_t *__s2,
			 size_t __n)  ;

 

extern int wcscoll  (__const wchar_t *__s1, __const wchar_t *__s2)  ;
 


extern size_t wcsxfrm  (wchar_t *__s1, __const wchar_t *__s2, size_t __n)  ;

 
extern wchar_t *wcsdup  (__const wchar_t *__s)  ;

 
extern wchar_t *wcschr  (__const wchar_t *__wcs, wchar_t __wc)  ;
 
extern wchar_t *wcsrchr  (__const wchar_t *__wcs, wchar_t __wc)  ;

 

extern size_t wcscspn  (__const wchar_t *__wcs,
			    __const wchar_t *__reject)  ;
 

extern size_t wcsspn  (__const wchar_t *__wcs, __const wchar_t *__accept)  ;
 
extern wchar_t *wcspbrk  (__const wchar_t *__wcs,
			      __const wchar_t *__accept)  ;
 
extern wchar_t *wcsstr  (__const wchar_t *__haystack,
			     __const wchar_t *__needle)  ;
 
extern wchar_t *wcstok  (wchar_t *__s, __const wchar_t *__delim,
			     wchar_t **ptr)  ;

 
extern size_t wcslen  (__const wchar_t *__s)  ;


 
extern wchar_t *wmemchr  (__const wchar_t *__s, wchar_t __c, size_t __n)  ;

 
extern int wmemcmp  (__const wchar_t *__s1, __const wchar_t *__s2,
			 size_t __n)  ;

 
extern wchar_t *wmemcpy  (wchar_t *__s1, __const wchar_t *__s2,
			      size_t __n)  ;

 

extern wchar_t *wmemmove  (wchar_t *__s1, __const wchar_t *__s2,
			       size_t __n)  ;

 
extern wchar_t *wmemset  (wchar_t *__s, wchar_t __c, size_t __n)  ;


 

extern wint_t btowc  (int __c)  ;

 

extern int wctob  (wint_t __c)  ;

 

extern int mbsinit  (__const mbstate_t *__ps)  ;

 

extern size_t __mbrtowc  (wchar_t *__pwc, __const char *__s, size_t __n,
			      mbstate_t *__p)  ;
extern size_t mbrtowc  (wchar_t *__pwc, __const char *__s, size_t __n,
			    mbstate_t *__p)  ;

 
extern size_t __wcrtomb  (char *__s, wchar_t __wc, mbstate_t *__ps)  ;
extern size_t wcrtomb  (char *__s, wchar_t __wc, mbstate_t *__ps)  ;

 
extern size_t __mbrlen  (__const char *__s, size_t __n, mbstate_t *__ps)  ;
extern size_t mbrlen  (__const char *__s, size_t __n, mbstate_t *__ps)  ;








 

extern size_t __mbsrtowcs  (wchar_t *__dst, __const char **__src,
				size_t __len, mbstate_t *__ps)  ;
extern size_t mbsrtowcs  (wchar_t *__dst, __const char **__src,
			      size_t __len, mbstate_t *__ps)  ;

 

extern size_t __wcsrtombs  (char *__dst, __const wchar_t **__src,
				size_t __len, mbstate_t *__ps)  ;
extern size_t wcsrtombs  (char *__dst, __const wchar_t **__src,
			      size_t __len, mbstate_t *__ps)  ;


# 214 "/usr/include/wchar.h" 3



 

extern double wcstod  (__const wchar_t *__nptr, wchar_t **__endptr)  ;









 

extern long int wcstol  (__const wchar_t *__nptr, wchar_t **__endptr,
			     int __base)  ;

 

extern unsigned long int wcstoul  (__const wchar_t *__nptr,
				       wchar_t **__endptr, int __base)  ;

# 249 "/usr/include/wchar.h" 3



 

extern double __wcstod_internal  (__const wchar_t *__nptr,
				      wchar_t **__endptr, int __group)  ;
extern float __wcstof_internal  (__const wchar_t *__nptr,
				     wchar_t **__endptr, int __group)  ;
extern long double  __wcstold_internal  (__const wchar_t *__nptr,
						wchar_t **__endptr,
						int __group)  ;

extern long int __wcstol_internal  (__const wchar_t *__nptr,
					wchar_t **__endptr, int __base,
					int __group)  ;
extern unsigned long int __wcstoul_internal  (__const wchar_t *__nptr,
						  wchar_t **__endptr,
						  int __base, int __group)  ;
# 276 "/usr/include/wchar.h" 3



# 306 "/usr/include/wchar.h" 3



# 321 "/usr/include/wchar.h" 3



} 


# 41 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-v3/bits/std_cwchar.h" 2 3



extern "C" {





























 
 
 
 
 






}























# 38 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-v3/bits/std_iosfwd.h" 2 3


namespace std {

   
  template<typename _CharT> struct char_traits;
  template<typename _Alloc> class allocator;

   
  template<> class char_traits<char>;

  template<> class char_traits<wchar_t>;


  template<typename _CharT, typename _Traits = char_traits<_CharT> >
  class basic_ios;

  template<typename _CharT, typename _Traits = char_traits<_CharT> >
  class basic_streambuf;

  template<typename _CharT, typename _Traits = char_traits<_CharT> >
  class basic_istream;

  template<typename _CharT, typename _Traits = char_traits<_CharT> >
  class basic_ostream;

  template<typename _CharT, typename _Traits = char_traits<_CharT> >
  class basic_iostream;

  template<typename _CharT, typename _Traits = char_traits<_CharT>,
	    typename _Alloc = allocator<_CharT> >
  class basic_stringbuf;

  template<typename _CharT, typename _Traits = char_traits<_CharT>,
	   typename _Alloc = allocator<_CharT> >
  class basic_istringstream;

  template<typename _CharT, typename _Traits = char_traits<_CharT>,
	   typename _Alloc = allocator<_CharT> >
  class basic_ostringstream;

  template<typename _CharT, typename _Traits = char_traits<_CharT>,
	   typename _Alloc = allocator<_CharT> >
  class basic_stringstream;

  template<typename _CharT, typename _Traits = char_traits<_CharT> >
  class basic_filebuf;

  template<typename _CharT, typename _Traits = char_traits<_CharT> >
  class basic_ifstream;

  template<typename _CharT, typename _Traits = char_traits<_CharT> >
  class basic_ofstream;

  template<typename _CharT, typename _Traits = char_traits<_CharT> >
  class basic_fstream;

  template<typename _CharT, typename _Traits = char_traits<_CharT> >
  class istreambuf_iterator;

  template<typename _CharT, typename _Traits = char_traits<_CharT> >
  class ostreambuf_iterator;


   
  class ios_base; 


  template<class _State> struct fpos;

   
   
   
   
  typedef fpos<mbstate_t> 		streampos;

  typedef fpos<mbstate_t> 		wstreampos;



  typedef basic_ios<char> 		ios;
  typedef basic_streambuf<char> 	streambuf;
  typedef basic_istream<char> 		istream;
  typedef basic_ostream<char> 		ostream;
  typedef basic_iostream<char> 		iostream;
  typedef basic_stringbuf<char> 	stringbuf;
  typedef basic_istringstream<char> 	istringstream;
  typedef basic_ostringstream<char> 	ostringstream;
  typedef basic_stringstream<char> 	stringstream;
  typedef basic_filebuf<char> 		filebuf;
  typedef basic_ifstream<char> 		ifstream;
  typedef basic_ofstream<char> 		ofstream;
  typedef basic_fstream<char> 		fstream;


  typedef basic_ios<wchar_t> 		wios;
  typedef basic_streambuf<wchar_t> 	wstreambuf;
  typedef basic_istream<wchar_t> 	wistream;
  typedef basic_ostream<wchar_t> 	wostream;
  typedef basic_iostream<wchar_t> 	wiostream;
  typedef basic_stringbuf<wchar_t> 	wstringbuf;
  typedef basic_istringstream<wchar_t> 	wistringstream;
  typedef basic_ostringstream<wchar_t> 	wostringstream;
  typedef basic_stringstream<wchar_t> 	wstringstream;
  typedef basic_filebuf<wchar_t> 	wfilebuf;
  typedef basic_ifstream<wchar_t> 	wifstream;
  typedef basic_ofstream<wchar_t> 	wofstream;
  typedef basic_fstream<wchar_t> 	wfstream;


}  









# 41 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-v3/bits/std_complex.h" 2 3



namespace std
{
     
    template<typename _Tp> class complex;
    template<> class complex<float>;
    template<> class complex<double>;
    template<> class complex<long double>;

    template<typename _Tp> _Tp abs(const complex<_Tp>&);
    template<typename _Tp>  _Tp arg(const complex<_Tp>&);

    template<typename _Tp> complex<_Tp> conj(const complex<_Tp>&);
    template<typename _Tp> complex<_Tp> polar(const _Tp&, const _Tp&);

     
    template<typename _Tp> complex<_Tp> cos(const complex<_Tp>&);
    template<typename _Tp> complex<_Tp> cosh(const complex<_Tp>&);
    template<typename _Tp> complex<_Tp> exp(const complex<_Tp>&);
    template<typename _Tp> complex<_Tp> log(const complex<_Tp>&);
    template<typename _Tp> complex<_Tp> log10(const complex<_Tp>&);
    template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, int);
    template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, const _Tp&);
    template<typename _Tp> complex<_Tp> pow (const complex<_Tp>&,
                                             const complex<_Tp>&);
    template<typename _Tp> complex<_Tp> pow(const _Tp&, const complex<_Tp>&);
    template<typename _Tp> complex<_Tp> sin(const complex<_Tp>&);
    template<typename _Tp> complex<_Tp> sinh(const complex<_Tp>&);
    template<typename _Tp> complex<_Tp> sqrt(const complex<_Tp>&);
    template<typename _Tp> complex<_Tp> tan(const complex<_Tp>&);
    template<typename _Tp> complex<_Tp> tanh(const complex<_Tp>&);
    
    
     
     
     
    template <typename _Tp>
    class complex
    {
    public:
        typedef _Tp value_type;

        complex (const _Tp& = _Tp(), const _Tp & = _Tp());

         
         

        template <typename _Up>
           complex (const complex<_Up>&);
        
        _Tp real () const;
        _Tp imag () const;

        complex<_Tp>& operator= (const _Tp&);
        complex<_Tp>& operator+= (const _Tp&);
        complex<_Tp>& operator-= (const _Tp&);
        complex<_Tp>& operator*= (const _Tp&);
        complex<_Tp>& operator/= (const _Tp&);

         
         
         

        template <typename _Up>
           complex<_Tp>& operator= (const complex<_Up>&);
        template <typename _Up>
           complex<_Tp>& operator+= (const complex<_Up>&);
        template <typename _Up>
           complex<_Tp>& operator-= (const complex<_Up>&);
        template <typename _Up>
           complex<_Tp>& operator*= (const complex<_Up>&);
        template <typename _Up>
           complex<_Tp>& operator/= (const complex<_Up>&);

    private:
        _Tp _M_real, _M_imag;
    };

    template<typename _Tp>
    inline _Tp
    complex<_Tp>::real() const { return _M_real; }

    template<typename _Tp>
    inline _Tp
    complex<_Tp>::imag() const { return _M_imag; }

    
     
     
     

     
     
     
    template<> class complex<float>
    {
    public:
        typedef float value_type;

        complex(float = 0.0f, float = 0.0f);

	complex(const complex& __z) : _M_value(__z._M_value) {}

        explicit complex(const complex<double>&);
        explicit complex(const complex<long double>&);

        float real() const;
        float imag() const;

        complex<float>& operator= (float);
        complex<float>& operator+= (float);
        complex<float>& operator-= (float);
        complex<float>& operator*= (float);
        complex<float>& operator/= (float);
        
         
         
         

        template <typename _Tp>
           complex<float>&operator= (const complex<_Tp>&);
        template <typename _Tp>
           complex<float>& operator+= (const complex<_Tp>&);
        template <class _Tp>
           complex<float>& operator-= (const complex<_Tp>&);
        template <class _Tp>
           complex<float>& operator*= (const complex<_Tp>&);
        template <class _Tp>
           complex<float>&operator/= (const complex<_Tp>&);

    private:
        typedef __complex__ float _ComplexT;
        _ComplexT _M_value;

        complex(_ComplexT __z) : _M_value(__z) {}
        
        friend class complex<double>;
        friend class complex<long double>;

        friend float abs<>(const complex<float>&);
        friend float arg<>(const complex<float>&);

        friend complex<float> conj<>(const complex<float>&);

        friend complex<float> cos<>(const complex<float>&);
        friend complex<float> cosh<>(const complex<float>&);
        friend complex<float> exp<>(const complex<float>&);
        friend complex<float> log<>(const complex<float>&);
        friend complex<float> log10<>(const complex<float>&);
        friend complex<float> pow<>(const complex<float>&, int);
        friend complex<float> pow<>(const complex<float>&, const float&);
        friend complex<float> pow<>(const complex<float>&,
                                    const complex<float>&);
        friend complex<float> pow<>(const float&, const complex<float>&);
        friend complex<float> sin<>(const complex<float>&);
        friend complex<float> sinh<>(const complex<float>&);
        friend complex<float> sqrt<>(const complex<float>&);
        friend complex<float> tan<>(const complex<float>&);
        friend complex<float> tanh<>(const complex<float>&);
  };

    inline float
    complex<float>::real() const
    { return __real__ _M_value; }

    inline float
    complex<float>::imag() const
    { return __imag__ _M_value; }


     
     
     
    template<> class complex<double>
    {
    public:
        typedef double value_type;

        complex(double  =0.0, double =0.0);

	complex(const complex& __z) : _M_value(__z._M_value) {}

        complex(const complex<float>&);
        explicit complex(const complex<long double>&);
        
        double real () const;
        double imag () const;
        
        complex<double>& operator= (double);
        complex<double>& operator+= (double);
        complex<double>& operator-= (double);
        complex<double>& operator*= (double);
        complex<double>& operator/= (double);

         
         

        template <typename _Tp>
           complex<double>& operator= (const complex<_Tp>&);
        template <typename _Tp>
           complex<double>& operator+= (const complex<_Tp>&);
        template <typename _Tp>
           complex<double>& operator-= (const complex<_Tp>&);
        template <typename _Tp>
           complex<double>& operator*= (const complex<_Tp>&);
        template <typename _Tp>
        complex<double>& operator/= (const complex<_Tp>&);

    private:
        typedef __complex__ double _ComplexT;
        _ComplexT _M_value;

        complex(_ComplexT __z) : _M_value(__z) {}
        
        friend class complex<float>;
        friend class complex<long double>;

        friend double abs<>(const complex<double>&);
        friend double arg<>(const complex<double>&);

        friend complex<double> conj<>(const complex<double>&);

        friend complex<double> cos<>(const complex<double>&);
        friend complex<double> cosh<>(const complex<double>&);
        friend complex<double> exp<>(const complex<double>&);
        friend complex<double> log<>(const complex<double>&);
        friend complex<double> log10<>(const complex<double>&);
        friend complex<double> pow<>(const complex<double>&, int);
        friend complex<double> pow<>(const complex<double>&, const double&);
        friend complex<double> pow<>(const complex<double>&,
                                    const complex<double>&);
        friend complex<double> pow<>(const double&, const complex<double>&);
        friend complex<double> sin<>(const complex<double>&);
        friend complex<double> sinh<>(const complex<double>&);
        friend complex<double> sqrt<>(const complex<double>&);
        friend complex<double> tan<>(const complex<double>&);
        friend complex<double> tanh<>(const complex<double>&);
    };

    inline double
    complex<double>::real() const
    { return __real__ _M_value; }

    inline double
    complex<double>::imag() const
    { return __imag__ _M_value; }


     
     
     
    template<> class complex<long double>
    {
    public:
        typedef long double value_type;

        complex(long double = 0.0L, long double = 0.0L);

	complex(const complex& __z) : _M_value(__z._M_value) {}

        complex(const complex<float>&);
        complex(const complex<double>&);

        long double real() const;
        long double imag() const;

        complex<long double>& operator= (long double);
        complex<long double>& operator+= (long double);
        complex<long double>& operator-= (long double);
        complex<long double>& operator*= (long double);
        complex<long double>& operator/= (long double);

         
         

        template<typename _Tp>
           complex<long double>& operator= (const complex<_Tp>&);
        template<typename _Tp>
           complex<long double>& operator+= (const complex<_Tp>&);
        template<typename _Tp>
           complex<long double>& operator-= (const complex<_Tp>&);
        template<typename _Tp>
           complex<long double>& operator*= (const complex<_Tp>&);
        template<typename _Tp>
        complex<long double>& operator/= (const complex<_Tp>&);

    private:
        typedef __complex__ long double _ComplexT;
        _ComplexT _M_value;

        complex(_ComplexT __z) : _M_value(__z) {}

        friend class complex<float>;
        friend class complex<double>;

        friend long double abs<>(const complex<long double>&);
        friend long double arg<>(const complex<long double>&);

        friend complex<long double> conj<>(const complex<long double>&);

        friend complex<long double> cos<>(const complex<long double>&);
        friend complex<long double> cosh<>(const complex<long double>&);
        friend complex<long double> exp<>(const complex<long double>&);
        friend complex<long double> log<>(const complex<long double>&);
        friend complex<long double> log10<>(const complex<long double>&);
        friend complex<long double> pow<>(const complex<long double>&, int);
        friend complex<long double> pow<>(const complex<long double>&,
                                          const long double&);
        friend complex<long double> pow<>(const complex<long double>&,
                                    const complex<long double>&);
        friend complex<long double> pow<>(const long double&,
                                          const complex<long double>&);
        friend complex<long double> sin<>(const complex<long double>&);
        friend complex<long double> sinh<>(const complex<long double>&);
        friend complex<long double> sqrt<>(const complex<long double>&);
        friend complex<long double> tan<>(const complex<long double>&);
        friend complex<long double> tanh<>(const complex<long double>&);
    };

    inline
    complex<long double>::complex(long double __r, long double __i)
    {
        __real__ _M_value = __r;
        __imag__ _M_value = __i;
    }

    inline
    complex<long double>::complex(const complex<float>& __z)
            : _M_value(_ComplexT(__z._M_value)) {}

    inline
    complex<long double>::complex(const complex<double>& __z)
            : _M_value(_ComplexT(__z._M_value)) {}

    inline long double
    complex<long double>::real() const
    { return __real__ _M_value; }

    inline long double
    complex<long double>::imag() const
    { return __imag__ _M_value; }

    inline complex<long double>&
    complex<long double>::operator= (long double __r)
    {
        __real__ _M_value = __r;
        __imag__ _M_value = 0.0L;
        return *this;
    }

    inline complex<long double>&
    complex<long double>::operator+= (long double __r)
    {
        __real__ _M_value += __r;
        return *this;
    }

    inline complex<long double>&
    complex<long double>::operator-= (long double __r)
    {
        __real__ _M_value -= __r;
        return *this;
    }

    inline complex<long double>&
    complex<long double>::operator*= (long double __r)
    {
        __real__ _M_value *= __r;
        return *this;
    }

    inline complex<long double>&
    complex<long double>::operator/= (long double __r)
    {
        __real__ _M_value /= __r;
        return *this;
    }

    template<typename _Tp>
    inline complex<long double>&
    complex<long double>::operator= (const complex<_Tp>& __z)
    {
        __real__ _M_value = __z.real();
        __imag__ _M_value = __z.imag();
        return *this;
    }

    template<typename _Tp>
    inline complex<long double>&
    complex<long double>::operator+= (const complex<_Tp>& __z)
    {
        __real__ _M_value += __z.real();
        __imag__ _M_value += __z.imag();
        return *this;
    }

    template<typename _Tp>
    inline complex<long double>&
    complex<long double>::operator-= (const complex<_Tp>& __z)
    {
        __real__ _M_value -= __z.real();
        __imag__ _M_value -= __z.imag();
        return *this;
    }
    
    template<typename _Tp>
    inline complex<long double>&
    complex<long double>::operator*= (const complex<_Tp>& __z)
    {
        _ComplexT __t;
        __real__ __t = __z.real();
        __imag__ __t = __z.imag();
        _M_value *= __t;
        return *this;
    }

    template<typename _Tp>
    inline complex<long double>&
    complex<long double>::operator/= (const complex<_Tp>& __z)
    {
        _ComplexT __t;
        __real__ __t = __z.real();
        __imag__ __t = __z.imag();
        _M_value /= __t;
        return *this;
    }

     
     
     
    inline
    complex<float>::complex(float r, float i)
    {
        __real__ _M_value = r;
        __imag__ _M_value = i;
    }

    inline
    complex<float>::complex(const complex<double>& __z)
            : _M_value(_ComplexT(__z._M_value)) {}

    inline
    complex<float>::complex(const complex<long double>& __z)
            : _M_value(_ComplexT(__z._M_value)) {}

    inline complex<float>&
    complex<float>::operator= (float __f)
    {
        __real__ _M_value = __f;
        __imag__ _M_value = 0.0f;
        return *this;
    }

    inline complex<float>&
    complex<float>::operator+= (float __f)
    {
        __real__ _M_value += __f;
        return *this;
    }

    inline complex<float>&
    complex<float>::operator-= (float __f)
    {
        __real__ _M_value -= __f;
        return *this;
    }

    inline complex<float>&
    complex<float>::operator*= (float __f)
    {
        _M_value *= __f;
        return *this;
    }

    inline complex<float>&
    complex<float>::operator/= (float __f)
    {
        _M_value /= __f;
        return *this;
    }

    template<typename _Tp>
    inline complex<float>&
    complex<float>::operator= (const complex<_Tp>& __z)
    {
        __real__ _M_value = __z.real();
        __imag__ _M_value = __z.imag();
        return *this;
    }

    template<typename _Tp>
    inline complex<float>&
    complex<float>::operator+= (const complex<_Tp>& __z)
    {
        __real__ _M_value += __z.real();
        __imag__ _M_value += __z.imag();
        return *this;
    }
    
    template<typename _Tp>
    inline complex<float>&
    complex<float>::operator-= (const complex<_Tp>& __z)
    {
        __real__ _M_value -= __z.real();
        __imag__ _M_value -= __z.real();
        return *this;
    }

    template<typename _Tp>
    inline complex<float>&
    complex<float>::operator*= (const complex<_Tp>& __z)
    {
        _ComplexT __t;
        __real__ __t = __z.real();
        __imag__ __t = __z.imag();
        _M_value *= __t;
        return *this;
    }

    template<typename _Tp>
    inline complex<float>&
    complex<float>::operator/= (const complex<_Tp>& __z)
    {
        _ComplexT __t;
        __real__ __t = __z.real();
        __imag__ __t = __z.imag();
        _M_value /= __t;
        return *this;
    }


     
     
     
    inline
    complex<double>::complex(double __r, double __i)
    {
        __real__ _M_value = __r;
        __imag__ _M_value = __i;
    }

    inline
    complex<double>::complex(const complex<float>& __z)
            : _M_value(_ComplexT(__z._M_value)) {}

    inline
    complex<double>::complex(const complex<long double>& __z)
    {
        __real__ _M_value = __z.real();
        __imag__ _M_value = __z.imag();
    }

    inline complex<double>&
    complex<double>::operator= (double __d)
    {
        __real__ _M_value = __d;
        __imag__ _M_value = 0.0;
        return *this;
    }

    inline complex<double>&
    complex<double>::operator+= (double __d)
    {
        __real__ _M_value += __d;
        return *this;
    }

    inline complex<double>&
    complex<double>::operator-= (double __d)
    {
        __real__ _M_value -= __d;
        return *this;
    }

    inline complex<double>&
    complex<double>::operator*= (double __d)
    {
        _M_value *= __d;
        return *this;
    }

    inline complex<double>&
    complex<double>::operator/= (double __d)
    {
        _M_value /= __d;
        return *this;
    }

    template<typename _Tp>
    inline complex<double>&
    complex<double>::operator= (const complex<_Tp>& __z)
    {
        __real__ _M_value = __z.real();
        __imag__ _M_value = __z.imag();
        return *this;
    }
    
    template<typename _Tp>
    inline complex<double>&
    complex<double>::operator+= (const complex<_Tp>& __z)
    {
        __real__ _M_value += __z.real();
        __imag__ _M_value += __z.imag();
        return *this;
    }

    template<typename _Tp>
    inline complex<double>&
    complex<double>::operator-= (const complex<_Tp>& __z)
    {
        __real__ _M_value -= __z.real();
        __imag__ _M_value -= __z.imag();
        return *this;
    }

    template<typename _Tp>
    inline complex<double>&
    complex<double>::operator*= (const complex<_Tp>& __z)
    {
        _ComplexT __t;
        __real__ __t = __z.real();
        __imag__ __t = __z.imag();
        _M_value *= __t;
        return *this;
    }

    template<typename _Tp>
    inline complex<double>&
    complex<double>::operator/= (const complex<_Tp>& __z)
    {
        _ComplexT __t;
        __real__ __t = __z.real();
        __imag__ __t = __z.imag();
        _M_value /= __t;
        return *this;
    }

     
     
     
     
    template<typename _Tp>
    inline 
    complex<_Tp>::complex(const _Tp& __r, const _Tp& __i)
            : _M_real(__r), _M_imag(__i) {}

    template<typename _Tp>
       template<typename _Up>
    inline 
    complex<_Tp>::complex(const complex<_Up>& __z)
            : _M_real(__z.real()), _M_imag(__z.imag()) {}

     
    template<typename _Tp>
    inline complex<_Tp>
    conj(const complex<_Tp>& __z)
    { return complex<_Tp>(__z.real(), -__z.imag()); }

     
    template<typename _Tp>
    inline _Tp
    norm(const complex<_Tp>& __z)
    {
         
        return __z.real() * __z.real() + __z.imag() * __z.imag();
    }
        
    template<typename _Tp>
    complex<_Tp>&
    complex<_Tp>::operator= (const _Tp& __t)
    {
        _M_real = __t;
        _M_imag = _Tp();
        return *this;
    }

     
    template<typename _Tp>
    inline complex<_Tp>&
    complex<_Tp>::operator+= (const _Tp& __t)
    {
        _M_real += __t;
        return *this;
    }

     
    template<typename _Tp>
    inline complex<_Tp>&
    complex<_Tp>::operator-= (const _Tp& __t)
    {
        _M_real -= __t;
        return *this;
    }

     
    template<typename _Tp>
    complex<_Tp>&
    complex<_Tp>::operator*= (const _Tp& __t)
    {
        _M_real *= __t;
        _M_imag *= __t;
        return *this;
    }

     
    template<typename _Tp>
    complex<_Tp>&
    complex<_Tp>::operator/= (const _Tp& __t)
    {
        _M_real /= __t;
        _M_imag /= __t;
        return *this;
    }

    template<typename _Tp>
       template<typename _Up>
    complex<_Tp>&
    complex<_Tp>::operator= (const complex<_Up>& __z)
    {
        _M_real = __z.real();
        _M_imag = __z.imag();
        return *this;
    }

     
    template<typename _Tp>
       template<typename _Up>
    complex<_Tp>&
    complex<_Tp>::operator+= (const complex<_Up>& __z)
    {
        _M_real += __z.real();
        _M_imag += __z.imag();
        return *this;
    }

     
    template<typename _Tp>
       template<typename _Up>
    complex<_Tp>&
    complex<_Tp>::operator-= (const complex<_Up>& __z)
    {
        _M_real -= __z.real();
        _M_imag -= __z.imag();
        return *this;
    }

     
     
    template<typename _Tp>
       template<typename _Up>
    complex<_Tp>&
    complex<_Tp>::operator*= (const complex<_Up>& __z)
    {
        _Tp __r = _M_real * __z.real() - _M_imag * __z.imag();
        _M_imag = _M_real * __z.imag() + _M_imag * __z.real();
        _M_real = __r;
        return *this;
    }

     
     
    template<typename _Tp>
       template<typename _Up>
    complex<_Tp>&
    complex<_Tp>::operator/= (const complex<_Up>& __z)
    {
        _Tp __r =  _M_real * __z.real() + _M_imag * __z.imag();
        _Tp __n = norm(__z);
        _M_imag = (_M_real * __z.imag() - _M_imag * __z.real()) / __n;
        _M_real = __r / __n;
        return *this;
    }
    

     
    template<typename _Tp>
    inline complex<_Tp>
    operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
    { return complex<_Tp> (__x) += __y; }

    template<typename _Tp>
    inline complex<_Tp>
    operator+(const complex<_Tp>& __x, const _Tp& __y)
    { return complex<_Tp> (__x) += __y; }

    template<typename _Tp>
    inline complex<_Tp>
    operator+(const _Tp& __x, const complex<_Tp>& __y)
    { return complex<_Tp> (__y) += __x; }

    template<typename _Tp>
    inline complex<_Tp>
    operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
    { return complex<_Tp> (__x) -= __y; }
    
    template<typename _Tp>
    inline complex<_Tp>
    operator-(const complex<_Tp>& __x, const _Tp& __y)
    { return complex<_Tp> (__x) -= __y; }

    template<typename _Tp>
    inline complex<_Tp>
    operator-(const _Tp& __x, const complex<_Tp>& __y)
    { return complex<_Tp> (__x) -= __y; }

    template<typename _Tp>
    inline complex<_Tp>
    operator*(const complex<_Tp>& __x, const complex<_Tp>& __y)
    { return complex<_Tp> (__x) *= __y; }

    template<typename _Tp>
    inline complex<_Tp>
    operator*(const complex<_Tp>& __x, const _Tp& __y)
    { return complex<_Tp> (__x) *= __y; }

    template<typename _Tp>
    inline complex<_Tp>
    operator*(const _Tp& __x, const complex<_Tp>& __y)
    { return complex<_Tp> (__y) *= __x; }

    template<typename _Tp>
    inline complex<_Tp>
    operator/(const complex<_Tp>& __x, const complex<_Tp>& __y)
    { return complex<_Tp> (__x) /= __y; }
    
    template<typename _Tp>
    inline complex<_Tp>
    operator/(const complex<_Tp>& __x, const _Tp& __y)
    { return complex<_Tp> (__x) /= __y; }

    template<typename _Tp>
    inline complex<_Tp>
    operator/(const _Tp& __x, const complex<_Tp>& __y)
    { return complex<_Tp> (__x) /= __y; }

    template<typename _Tp>
    inline complex<_Tp>
    operator+(const complex<_Tp>& __x)
    { return __x; }

    template<typename _Tp>
    inline complex<_Tp>
    operator-(const complex<_Tp>& __x)
    {  return complex<_Tp>(-__x.real(), -__x.imag()); }

    template<typename _Tp>
    inline bool
    operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
    { return __x.real() == __y.real() && __x.imag == __y.imag(); }

    template<typename _Tp>
    inline bool
    operator==(const complex<_Tp>& __x, const _Tp& __y)
    { return __x.real() == __y && __x.imag() == 0; }

    template<typename _Tp>
    inline bool
    operator==(const _Tp& __x, const complex<_Tp>& __y)
    { return __x == __y.real() && 0 == __y.imag(); }

    template<typename _Tp>
    inline bool
    operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
    { return __x.real() != __y.real() || __x.imag() != __y.imag(); }

    template<typename _Tp>
    inline bool
    operator!=(const complex<_Tp>& __x, const _Tp& __y)
    {  return __x.real() != __y || __x.imag() != 0; }

    template<typename _Tp>
    inline bool
    operator!=(const _Tp& __x, const complex<_Tp>& __y)
    { return __x != __y.real() || 0 != __y.imag(); }

    template<typename _Tp, typename _CharT, class _Traits>
    basic_istream<_CharT, _Traits>&
    operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&);

    template<typename _Tp, typename _CharT, class _Traits>
    basic_ostream<_CharT, _Traits>&
    operator<<(basic_ostream<_CharT, _Traits>&, const complex<_Tp>&);


     
    template <typename _Tp>
    inline _Tp
    real (const complex<_Tp>& __z)
    { return __z.real(); }
    
    template <typename _Tp>
    inline _Tp
    imag (const complex<_Tp>& __z)
    { return __z.imag(); }
    

     
    template<>
    inline complex<float>
    conj(const complex<float> &__x)






    { return complex<float>(~__x._M_value); }


    template<>
    inline complex<double>
    conj(const complex<double> &__x)
    {  return complex<double> (~__x._M_value); }

    template<>
    inline complex<long double>
    conj(const complex<long double> &__x)
    {
        return complex<long double> (~__x._M_value);
    }

}  


# 2 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-v3/complex" 2 3


# 1 "foo.cc" 2

using std::complex;
main() {
  complex<double> u(1.,2.);
  complex<double> v(3.,4.);
  u = u * v;
}


More information about the Gcc-bugs mailing list