Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RTTI class IDs #498

Merged
merged 2 commits into from
Nov 24, 2024
Merged

Fix RTTI class IDs #498

merged 2 commits into from
Nov 24, 2024

Conversation

ssvine
Copy link
Contributor

@ssvine ssvine commented Nov 17, 2024

This PR fixes two issues:

  1. The new version of msvc (version 19.42) bundled with Visual Studio 2022 version 17.12 breaks nb::counter_id() hack because of this change. This may lead to crashes.
  2. Several object IDs like OBJECT_CLASS_TTerminalItem get wrong values because they are defined in different translation units, so nb::counter_id() is reset to 1 in each of them.

P.S. nb::counter_id() hack works only in msvc for a long time now. Perhaps it's better to use __COUNTER__ macro that works in all major compilers: msvc, gcc, clang.

This is because nb::counter_id() resets to 1 in every translation unit
@michaellukashov michaellukashov merged commit 9177907 into michaellukashov:main Nov 24, 2024
2 checks passed
@ssvine ssvine deleted the fix-rtti branch November 25, 2024 16:42
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.

2 participants