[cfe-users] Why does this testcase fail in clang-60?

Yuri via cfe-users cfe-users at lists.llvm.org
Mon Mar 26 19:52:08 PDT 2018


This testcase:

# include <complex>
# include <math.h>

# define _I ((complex_t)(1i))
typedef std::complex<double> complex_t;

complex_t f(const double omega) {
   complex_t p = cos (omega) +  _I * sin (omega);
   return p;
}

works in clang40 and clang50, but fails in clang60:

c.c:9:32: error: implicit conversion from '_Complex int' to 'double' is 
not permitted in C++
   complex_t p = cos (omega) +  _I * sin (omega);
                                ^~
c.c:5:26: note: expanded from macro '_I'
# define _I ((complex_t)(1i))
              ~           ^~
1 error generated.


Yuri




More information about the cfe-users mailing list