pybind / pybind/pybind11

[BUG]: Errors in VS 2022 and c++ 20

Open
#3,824 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

compiler issue
Dominant language
C++
Stars
18k
Forks
2.3k
Avg merge
5d 17h
Merged PRs (30d)
10

Description

Required prerequisites
Problem description

when i build with pybind11, it failed to build
i use Visual Studio 2022 and C++ 20

##Errors

Severity	Code	Description	Project	File	Line	Suppression State
Error	C2678	binary '-': no operator found which takes a left-hand operand of type 'const L' (or there is no acceptable conversion)	VTIL-Python	J:\My_Projects\VTIL-Python\external\pybind11\include\pybind11\operators.h	115	
Error	C2672	'pybind11::class_<vtil::symbolic::directive::instance>::def': no matching overloaded function found	VTIL-Python	J:\My_Projects\VTIL-Python\external\pybind11\include\pybind11\operators.h	52	
Error	C2893	Failed to specialize function template 'pybind11::class_<vtil::symbolic::directive::instance> &pybind11::class_<vtil::symbolic::directive::instance>::def(const char *,Func &&,const Extra &...)'	VTIL-Python	J:\My_Projects\VTIL-Python\external\pybind11\include\pybind11\operators.h	47	
Error	C2678	binary '*': no operator found which takes a left-hand operand of type 'const L' (or there is no acceptable conversion)	VTIL-Python	J:\My_Projects\VTIL-Python\external\pybind11\include\pybind11\operators.h	117	
Error	C2088	'*': illegal for struct	VTIL-Python	J:\My_Projects\VTIL-Python\external\pybind11\include\pybind11\operators.h	117	

Reproducible example code

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pybind11/include/pybind11/operators.h at lines 47, 52, 115, and 117, using the reported Visual Studio 2022 and C++20 errors as the entry point. Because no reproducible example is provided, first establish a minimal reproduction of the operator errors. Done means the failure is reproducible and its cause or required correction is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.