kokkos / mdspan

Reference implementation of mdspan targeting C++23
Other
413 stars 69 forks source link

Possible bug: I is a macro in complex.h #353

Closed fancidev closed 3 months ago

fancidev commented 3 months ago

This line uses the symbol I, but I is a macro defined in <complex.h> in C99. So, if complex.h is included before mdspan, a compilation error might occur.

I come across this issue in https://github.com/scipy/scipy/issues/21376.

I’m not sure if this is a bug, because I’m not sure how C99 and C++20 are supposed to work together, and I is a perfectly legal symbol for use in C++.

fancidev commented 3 months ago

It seems this may be a bug with the complex.h header shipped with certain compilers; they are probably supposed to guard the macro definition inside #ifndef __cplusplus. Therefore I close this issue now.