feat: drop C++11 support, require C++14 or newer - #6149
Conversation
The C++14 code paths become unconditional: std alias templates, std::make_index_sequence, lambda init-captures in py::init factories, [[deprecated]], and overload_cast. The CMake interface now requires cxx_std_14, setup_helpers rejects cxx_std below 14, and CI C++11 jobs move to C++14. Assisted-by: ClaudeCode:claude-fable-5
- ReadableFunctionSignature: use return type deduction, removing the PYBIND11_READABLE_FUNCTION_SIGNATURE_EXPR macro duplication. - constexpr_first/constexpr_last: use relaxed constexpr loops, removing the constexpr_impl recursion helpers. - constexpr_sum: one loop implementation, removing the __cpp_fold_expressions branch. - Use std::make_unique where the type is unchanged. - Replace 'typename std::X<...>::type' with the C++14 'std::X_t<...>' alias templates. Assisted-by: ClaudeCode:claude-fable-5
…nsparent-functors Both checks require the new C++14 minimum. Assisted-by: ClaudeCode:claude-fable-5
|
Doesn't really seem as worth it compared to CPP17 update |
Yeah, the "unshackling" aspect really only comes with dropping CPP14, too. But I'm still highly supportive of this work, as a stepping stone. When dropping CPP11 is done, we should evaluate if we want a release before also dropping CPP14, or plow through. |
|
The benefit is there's virtually no drawback to this. You can support the full macOS version range, for example (meaning you can still build with cibuldwheel's default settings). I think this could easily go into a 3.2 release, while C++17 we've been discussing making a 4.0 release and LTS'ing support for 3.x (which doesn't sound attractive, TBH). And this drops over 100 lines, simplifies a few hundred more, makes Yes, not as good as 17, but not as trivial a cleanup as it seems (we hit a lot of edge cases that got fixed in C++14). |
|
I'm waiting on pretty much any changes, though, till we get the pre-compile stack reviewed! Don't want to have to keep rebasing it, triggers a huge amount of CI. |
🤖 AI text below 🤖
Description
Drops C++11 support, making C++14 the minimum. This is the smaller subset of #6124 (which also drops C++14).
First commit removes the C++11 code paths:
detail/common.hgets a clear#errorbelow C++14; the hand-rolledenable_if_t-style aliases and the recursivemake_index_sequenceimplementation are replaced with thestdversions;overload_castand[[deprecated]]become unconditional; Intel minimum is now v19 (v18 was kept only for C++11).detail/init.hfactories always use lambda init-captures (move instead of copy).cxx_std_14on the interface target;setup_helpersrejectscxx_stdbelow 14; CI C++11 jobs move to C++14. Two cmake-build tests verify a consumer requesting C++11 is promoted.Second commit simplifies internals with C++14 features: return type deduction removes the
PYBIND11_READABLE_FUNCTION_SIGNATURE_EXPRmacro, relaxed-constexpr loops replace theconstexpr_implrecursion helpers and the__cpp_fold_expressionssplit inconstexpr_sum,std::make_uniqueand thestd::*_talias templates are used where the meaning is unchanged.conduit/is intentionally untouched (stays C++11-compatible), as is thefunc_wrapperextension point.Third commit enables the clang-tidy checks
modernize-make-uniqueandmodernize-use-transparent-functors(both need C++14) and applies the fixes in the headers and tests.Suggested changelog entry:
📚 Documentation preview 📚: https://pybind11--6149.org.readthedocs.build/