pybind / pybind11

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

Latest constexpr/type_caster changes don't compile on VS2017 15.3.3 #1100

Closed patrikhuber closed 6 years ago

patrikhuber commented 6 years ago

Hi!

The latest 3 commits to the master branch ("Make it possible to generate constexpr signatures in C++11 mode", "Use semi-constexpr signatures on MSVC", "Simplify function signature annotation and parsing") by @dean0x7d broke compiling on the latest stable VS2017 (15.3.3) for me.

The commit before that, f94d7598813d5f50f88ffad11f4622c02a3eb391, compiles fine, while the latest master commit fails to compile my bindings with the following errors:

Severity    Code    Description Project File    Line    Suppression State
Error   C2784   'pybind11::detail::descr<N1+N2,Ts1...,Ts2...> pybind11::detail::operator +(const pybind11::detail::descr<N1,Ts1...> &,const pybind11::detail::descr<N2,Ts2...> &)': could not deduce template argument for 'const pybind11::detail::descr<N2,Ts2...> &' from 'const int'    python-bindings C:\Users\Patrik\Projects\eos\eos-devel\eos\3rdparty\pybind11\include\pybind11\pybind11.h    166 
Error   C2676   binary '+': 'pybind11::detail::descr<9,type>' does not define this operator or a conversion to a type acceptable to the predefined operator python-bindings C:\Users\Patrik\Projects\eos\eos-devel\eos\3rdparty\pybind11\include\pybind11\pybind11.h    166 
Error   C3536   'signature': cannot be used before it is initialized    python-bindings C:\Users\Patrik\Projects\eos\eos-devel\eos\3rdparty\pybind11\include\pybind11\pybind11.h    167 
Error   C2651   'const auto': left of '::' must be a class, struct or union python-bindings C:\Users\Patrik\Projects\eos\eos-devel\eos\3rdparty\pybind11\include\pybind11\pybind11.h    167 
Error   C2062   type 'const auto' unexpected    python-bindings C:\Users\Patrik\Projects\eos\eos-devel\eos\3rdparty\pybind11\include\pybind11\pybind11.h    167 
Error   C2039   'types': is not a member of '`global namespace''    python-bindings C:\Users\Patrik\Projects\eos\eos-devel\eos\3rdparty\pybind11\include\pybind11\pybind11.h    167 
Error   C2228   left of '.text' must have class/struct/union    python-bindings C:\Users\Patrik\Projects\eos\eos-devel\eos\3rdparty\pybind11\include\pybind11\pybind11.h    170 
Error   C3536   'types': cannot be used before it is initialized    python-bindings C:\Users\Patrik\Projects\eos\eos-devel\eos\3rdparty\pybind11\include\pybind11\pybind11.h    170 
Error   C2228   left of '.data' must have class/struct/union    python-bindings C:\Users\Patrik\Projects\eos\eos-devel\eos\3rdparty\pybind11\include\pybind11\pybind11.h    170 
Error   C2660   'pybind11::cpp_function::initialize_generic': function does not take 2 arguments    python-bindings C:\Users\Patrik\Projects\eos\eos-devel\eos\3rdparty\pybind11\include\pybind11\pybind11.h    170 
Error   C2672   'pybind11::detail::type_descr': no matching overloaded function found   python-bindings c:\users\patrik\projects\eos\eos-devel\eos\3rdparty\pybind11\include\pybind11\cast.h    1827    
Error   C2784   'pybind11::detail::descr<N+,Ts...> pybind11::detail::type_descr(const pybind11::detail::descr<N,Ts...> &)': could not deduce template argument for 'const pybind11::detail::descr<N,Ts...> &' from 'const int'  python-bindings c:\users\patrik\projects\eos\eos-devel\eos\3rdparty\pybind11\include\pybind11\cast.h    1827    
Error   C2676   binary '+': 'pybind11::detail::descr<9,type>' does not define this operator or a conversion to a type acceptable to the predefined operator python-bindings C:\Users\Patrik\Projects\eos\eos-devel\eos\3rdparty\pybind11\include\pybind11\pybind11.h    166 
Error   C2088   '+': illegal for struct python-bindings C:\Users\Patrik\Projects\eos\eos-devel\eos\3rdparty\pybind11\include\pybind11\pybind11.h    166 

I'm compiling with /std:c++17 but it also fails without it.

I should have time to create a MWE tomorrow or Wednesday, but I thought I'd already report it, maybe it helps even without a MWE. I'm happy to test any fixes. I'm wondering why pybind11's AppVeyor build doesn't catch that actually. I hope it's not a problem in my code but f94d7598813d5f50f88ffad11f4622c02a3eb391 compiles fine, while the newest master doesn't.

patrikhuber commented 6 years ago

Hmm, I guess I need to update my custom type-casters - is that expected? I think it may have to do with my type-casters.

patrikhuber commented 6 years ago

I ended up "fixing" (avoiding) this by replacing all my glm types in the python bindings with Eigen vectors and matrices. I didn't dig much deeper into why this pybind11 update broke my glm type casters. It was really hard to find out where exactly these errors originate from. Anyway I'm happy with using only Eigen in the bindings, it means I don't have to maintain my own glm typecasters anymore.

ghost commented 5 years ago

There seems to be a bug in the Visual Studio compiler. We are waiting for this to be fixed. See: visualstudio.com