Skip to content

Comments

Strip noexcept from cpp17 function type bindings#5992

Draft
Skylion007 wants to merge 4 commits intopybind:masterfrom
Skylion007:skylion007/cpp17-claude-noexcept-2026-02-20
Draft

Strip noexcept from cpp17 function type bindings#5992
Skylion007 wants to merge 4 commits intopybind:masterfrom
Skylion007:skylion007/cpp17-claude-noexcept-2026-02-20

Conversation

@Skylion007
Copy link
Collaborator

@Skylion007 Skylion007 commented Feb 20, 2026

Description

Fix issue #2234 . Fix overloading to accept noexcept function types too and strip them. Mostly authored by ClaudeCode.

Suggested changelog entry:

  • noexcept is stripped from cpp17 function types to allow for better overloading of bindings.

@Skylion007 Skylion007 requested a review from rwgk February 20, 2026 18:49
@Skylion007 Skylion007 force-pushed the skylion007/cpp17-claude-noexcept-2026-02-20 branch from a7a3ed9 to e8b0584 Compare February 20, 2026 19:36
@Skylion007 Skylion007 force-pushed the skylion007/cpp17-claude-noexcept-2026-02-20 branch from e8b0584 to b303194 Compare February 20, 2026 19:48
@Skylion007 Skylion007 force-pushed the skylion007/cpp17-claude-noexcept-2026-02-20 branch from ad30bc0 to f530adb Compare February 20, 2026 20:26

template <typename Derived, typename Return, typename Class, typename... Args>
auto method_adaptor(Return (Class::*pmf)(Args...) const & noexcept)
-> Return (Derived::*)(Args...) const & noexcept {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I need to add tests for '&&' here i guess. Otherwise the fall through the perfect forwarding template... Sigh... I'll try construct some tests later I guess.

return pmf;
}

template <typename Derived, typename Return, typename Class, typename... Args>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe able to massively simplify this with a macro...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant