fix(tests): drop const before casting the NpTitleSecret deleting destructor slot #15756

Closed
imellag wants to merge 1 commit from upstream-pr/15756 into main
imellag commented 2026-11-04 12:35:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by imellag on 2026-11-04T12:35:10Z.


What

GuestNpCommonRuntime.cpp's NpTitleSecret case (from #13978) calls the deleting destructor through reinterpret_cast<Destructor>(owned->vtable[1]). The vtable slots are const void*, and clang refuses a reinterpret_cast that casts away const, so the test file stops the macOS build:

core/libs/tests/GuestNpCommonRuntime.cpp:531:5: error: reinterpret_cast from 'const void *' to 'Destructor' (aka 'void (*)(NpTitleSecretObject *)') casts away qualifiers

The slot is now taken through const_cast<void*> first, as the other vtable calls in the same file already do (line 475 and the stream reader and writer cases).

Tested

macOS 27.2, Apple M4 Pro, x86-64 Release under Rosetta 2, in the support branch support/macos-boot-1103 merged with main b11c7bf84f (the open macOS port PRs #7631, #7804, #4630, #11437 and local build fixes), with #15700 and #15755 applied. Without this commit the full build stops at line 531; with it the full build goes through, and ctest -R '^(guest_appcontent|guest_np_common_rtc|guest_np_common_state_predicates)' passes 9 of 9.

tools/check_conventions.py --base upstream/main passes. tools/pr_overlap.py merged the 11 PRs sharing the file without overlap; of the three it could not compare, #13270 and #13486 add this same line, and #12852 adds another vtable[1] call on a different object.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5154312269 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15756). Originally posted by [imellag](https://github.com/imellag) on 2026-11-04T12:35:10Z. --- ### What `GuestNpCommonRuntime.cpp`'s NpTitleSecret case (from #13978) calls the deleting destructor through `reinterpret_cast<Destructor>(owned->vtable[1])`. The vtable slots are `const void*`, and clang refuses a `reinterpret_cast` that casts away `const`, so the test file stops the macOS build: ``` core/libs/tests/GuestNpCommonRuntime.cpp:531:5: error: reinterpret_cast from 'const void *' to 'Destructor' (aka 'void (*)(NpTitleSecretObject *)') casts away qualifiers ``` The slot is now taken through `const_cast<void*>` first, as the other vtable calls in the same file already do (line 475 and the stream reader and writer cases). ### Tested macOS 27.2, Apple M4 Pro, x86-64 Release under Rosetta 2, in the support branch [`support/macos-boot-1103`](https://github.com/imellag/AnyPS5/commits/support/macos-boot-1103) merged with `main` `b11c7bf84f` (the open macOS port PRs #7631, #7804, #4630, #11437 and local build fixes), with #15700 and #15755 applied. Without this commit the full build stops at line 531; with it the full build goes through, and `ctest -R '^(guest_appcontent|guest_np_common_rtc|guest_np_common_state_predicates)'` passes 9 of 9. `tools/check_conventions.py --base upstream/main` passes. `tools/pr_overlap.py` merged the 11 PRs sharing the file without overlap; of the three it could not compare, #13270 and #13486 add this same line, and #12852 adds another `vtable[1]` call on a different object. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!15756
No description provided.