Closed
Description
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
2.13.0
Problem description
Environment:
Compiler: GCC 10.2
C++ Language Dialect: C++20 (std=c++20)
Error Message:
In file included from my_venv/include/pybind11/pybind11.h:19,
from my_venv/include/pybind11/numpy.h:12
my_venv/include/pybind11/typing.h:219:49: error: class template argument deduction failed:
219 | struct handle_type_name<typing::Literal<Literals...>> {
| ^~~
compilation terminated due to -Wfatal-errors.
It seems the error just comes from including pybind11 headers and it comes after upgrading to 2.13.
#if defined(__cpp_nontype_template_parameter_class)
template <typing::StringLiteral... Literals>
struct handle_type_name<typing::Literal<Literals...>> {
static constexpr auto name = const_name("Literal[")
+ pybind11::detail::concat(const_name(Literals.name)...)
+ const_name("]");
};
template <typing::StringLiteral StrLit>
struct handle_type_name<typing::TypeVar<StrLit>> {
static constexpr auto name = const_name(StrLit.name);
};
#endif
I see it tries to use the macro __cpp_nontype_template_parameter_class
to enable some template codes. However not sure why the macro check is success, but GCC 10.2 fails to compile the codes.
Reproducible example code
No response
Is this a regression? Put the last known working version here if it is.
2.12.0