fix(libc): build the libc++ regex_error test with clang #27320

Merged
magnub merged 1 commit from upstream-pr/27320 into main 2026-11-26 10:46:44 +00:00
magnub commented 2026-11-25 20:48:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by magnub on 2026-11-25T20:48:24Z.


What

GuestLibcxxRegexError.cpp cast vtable[2], a const void*, straight to a function pointer type. GCC accepts that; clang rejects it ("reinterpret_cast from 'const void *' to 'What' ... casts away qualifiers"), so guest_libcxx_regex_error_tests does not build on macOS. #27164 lists it as one of the targets that do not build there. The cast now goes through const_cast<void*>, as GuestLibcInternalBasicString.cpp and GuestLibcInternalLibcForwards.cpp already do. Test-only change.

Tested

macOS 27.0.1 on an Apple M1 Pro, Apple clang 21.0.0, x86_64 Release build under Rosetta 2. Build: main ff5b409dda plus #17425, #11049 and #26739, which the macOS build needs:

  • main: guest_libcxx_regex_error_tests fails to build with the error above.
  • this PR: it builds, and guest_libcxx_regex_error passes (1.06 s).

The error also reproduces with Ubuntu clang 18.1.3 on Linux, and the fixed line compiles there. tools/check_conventions.py --base origin/main passes. Log attached.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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 (Claude Code)

🤖 Generated with Claude Code

https://claude.ai/code/session_012LL9hfx4BY6MbUCYMduDAQ

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5498928566 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27320). Originally posted by [magnub](https://github.com/magnub) on 2026-11-25T20:48:24Z. --- ### What `GuestLibcxxRegexError.cpp` cast `vtable[2]`, a `const void*`, straight to a function pointer type. GCC accepts that; clang rejects it ("reinterpret_cast from 'const void *' to 'What' ... casts away qualifiers"), so `guest_libcxx_regex_error_tests` does not build on macOS. #27164 lists it as one of the targets that do not build there. The cast now goes through `const_cast<void*>`, as `GuestLibcInternalBasicString.cpp` and `GuestLibcInternalLibcForwards.cpp` already do. Test-only change. ### Tested macOS 27.0.1 on an Apple M1 Pro, Apple clang 21.0.0, x86_64 Release build under Rosetta 2. Build: `main` `ff5b409dda` plus #17425, #11049 and #26739, which the macOS build needs: - main: `guest_libcxx_regex_error_tests` fails to build with the error above. - this PR: it builds, and `guest_libcxx_regex_error` passes (1.06 s). The error also reproduces with Ubuntu clang 18.1.3 on Linux, and the fixed line compiles there. `tools/check_conventions.py --base origin/main` passes. Log attached. ### Checklist - [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 and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical 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 (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_012LL9hfx4BY6MbUCYMduDAQ
MarcZX10 commented 2026-11-25 20:51:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T20:51:50Z.

Review: APPROVED


Reviewed — looks good

The changed cast removes the const qualifier before converting the vtable entry to the function pointer type, addressing the reported Clang compile error while leaving the test call unchanged.

What I ran

Reviewed head 038792eb11d0112eea128e55467f590107fc556a using repo_read.py to inspect the PR description, commit list, diff, and the changed source file. No build or tests were run.

Results

Check Result Note
Source review passed One changed file reviewed
Build and tests not run Author-reported results only

Findings

Blocking

None.

Non-blocking

None.

Not verified

No build or test was run in this review; the macOS and Linux results in the description are author-reported. files.json was unavailable through the reader, so I could not compare the reviewed file against its reviewed-file inventory. No files were excluded in the manifest shown; it lists core/libs/tests/GuestLibcxxRegexError.cpp as included, and that full source was read.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6064820566 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27320#pullrequestreview-6064820566). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-25T20:51:50Z. **Review:** APPROVED --- # Reviewed — looks good The changed cast removes the const qualifier before converting the vtable entry to the function pointer type, addressing the reported Clang compile error while leaving the test call unchanged. ## What I ran Reviewed head `038792eb11d0112eea128e55467f590107fc556a` using `repo_read.py` to inspect the PR description, commit list, diff, and the changed source file. No build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | One changed file reviewed | | Build and tests | not run | Author-reported results only | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified No build or test was run in this review; the macOS and Linux results in the description are author-reported. `files.json` was unavailable through the reader, so I could not compare the reviewed file against its reviewed-file inventory. No files were excluded in the manifest shown; it lists `core/libs/tests/GuestLibcxxRegexError.cpp` as included, and that full source was read. ## To get this to a good state Nothing is required.
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!27320
No description provided.