pybind / pybind11

Seamless operability between C++11 and Python
https://pybind11.readthedocs.io/
Other
15.39k stars 2.08k forks source link

clang7 doesn't need experimental anymore #1554

Closed erickguan closed 5 years ago

erickguan commented 5 years ago

Issue description

#include <pybind11/stl.h> can't compile with clang++-7.0 because optional is no longer experimental.

I tried to put macro detection code in details/common.h but it doesn't work.

#if defined(__clang__) && __clang_major__ >= 7
#  define PYBIND11_CPP17
#endif

Reproducible example code

#include "pybind11/stl.h"

int main()
{
  return 0;
}
erickguan commented 5 years ago

I have encountered this once again with g++ 7.3 shipping with <optional>.

https://github.com/pybind/pybind11/commit/ff6bd092d482b0c4e51aeb7367c3e5ecbc18a9de

#  if defined(PYBIND11_CPP14) && (__has_include(<experimental/optional>) && \
                                 !__has_include(<optional>))

The problem comes with header files existed at the same time.

I understand playing with detection magic is dangerous and will break many builds. So what's the policy towards a fix?

erickguan commented 5 years ago

I used the old package between 2.2.0 ~ 2.2.4. It's fixed in 2.2.4.