tests: use function pointers in the concurrent backing read pairs #1163

Manually merged
github merged 1 commit from gh-pr/1163/head into gh-pr/1163/base 2026-11-26 09:45:53 +00:00
Owner

@⁠Nawid3333 on GitHub · 2026-10-07 20:31 UTC · original
Nawid3333:tests/vmem-pair-function-pointers → main · +3 −3 · 1 files · 1 commits · merged 2026-10-07 20:56 UTC

Problem

Since 7e011fa5 ("memory: allow concurrent backing reads"), main fails to build on Linux and macOS (main's own run on 45b6d2c5: https://github.com/KytyPS5/KytyPS5/actions/runs/37674771741/job/112975370415):

tests/VirtualMemoryAllocationTests.cpp:620:29: ... error: data member instantiated with function type 'bool (unsigned long, void *, unsigned long)'

CI builds each PR merged with the current main, so the Linux and macOS jobs of PRs built since then fail the same way.

Cause

TestConcurrentBackingReads builds its reader pairs as std::pair {TryReadBacking, TryReadSparseBacking}. Class template argument deduction also considers pair's const T1& / const T2& constructor. Its reference parameters don't decay the function names, so T1 and T2 are deduced as function types. A data member can't have function type, and with libstdc++ and libc++ instantiating that pair fails. The Windows build (clang-cl with MSVC's library) doesn't reject it, which is why Windows still builds.

Fix

Take the functions' addresses (&TryReadBacking, &TryReadSparseBacking), so the pairs hold function pointers. Three lines, test-only, no behaviour change.

Testing

  • Ubuntu 24.04 in WSL (clang 18, libstdc++ 13; the CI Linux job uses libstdc++ 14): on main 45b6d2c5 the build fails with the same error; with this change virtual_memory_allocation_tests builds and passes.
  • Windows 11 (clang-cl 19.1.5, Release): virtual_memory_allocation_tests builds and passes.
  • Fork CI builds on Windows, Linux and macOS: https://github.com/Nawid3333/KytyPS5/actions/runs/37680033036

AI use (per the README's AI policy): Claude (Anthropic) traced the failing jobs and wrote the change. Claude also ran the builds above on my machine. I reviewed the change before opening this PR.

🤖 Generated with Claude Code

**@⁠Nawid3333** on GitHub · 2026-10-07 20:31 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1163) `Nawid3333:tests/vmem-pair-function-pointers` → `main` · +3 −3 · 1 files · 1 commits · merged 2026-10-07 20:56 UTC ## Problem Since 7e011fa5 ("memory: allow concurrent backing reads"), `main` fails to build on Linux and macOS (`main`'s own run on 45b6d2c5: https://github.com/KytyPS5/KytyPS5/actions/runs/37674771741/job/112975370415): ``` tests/VirtualMemoryAllocationTests.cpp:620:29: ... error: data member instantiated with function type 'bool (unsigned long, void *, unsigned long)' ``` CI builds each PR merged with the current `main`, so the Linux and macOS jobs of PRs built since then fail the same way. ## Cause `TestConcurrentBackingReads` builds its reader pairs as `std::pair {TryReadBacking, TryReadSparseBacking}`. Class template argument deduction also considers `pair`'s `const T1&` / `const T2&` constructor. Its reference parameters don't decay the function names, so `T1` and `T2` are deduced as function types. A data member can't have function type, and with libstdc++ and libc++ instantiating that `pair` fails. The Windows build (clang-cl with MSVC's library) doesn't reject it, which is why Windows still builds. ## Fix Take the functions' addresses (`&TryReadBacking`, `&TryReadSparseBacking`), so the pairs hold function pointers. Three lines, test-only, no behaviour change. ## Testing - Ubuntu 24.04 in WSL (clang 18, libstdc++ 13; the CI Linux job uses libstdc++ 14): on `main` 45b6d2c5 the build fails with the same error; with this change `virtual_memory_allocation_tests` builds and passes. - Windows 11 (clang-cl 19.1.5, Release): `virtual_memory_allocation_tests` builds and passes. - Fork CI builds on Windows, Linux and macOS: https://github.com/Nawid3333/KytyPS5/actions/runs/37680033036 **AI use** (per the README's AI policy): Claude (Anthropic) traced the failing jobs and wrote the change. Claude also ran the builds above on my machine. I reviewed the change before opening this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
TestConcurrentBackingReads (7e011fa5) builds its reader pairs with
std::pair {TryReadBacking, TryReadSparseBacking}. Class template argument
deduction then also considers pair's const T1& / const T2& constructors, which
deduce function types, and libstdc++ and libc++ reject a pair member of
function type ("data member instantiated with function type"), so
virtual_memory_allocation_tests no longer compiles on Linux and macOS. MSVC's
library accepts it, which is why Windows still builds.

Take the functions' addresses so the pairs hold function pointers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:45:51 +00:00
github manually merged commit 4dcda93169 into gh-pr/1163/base 2026-11-26 09:45:53 +00:00
Author
Owner

@⁠Nmzik on GitHub · 2026-10-07 20:56 UTC · original

@⁠Nawid3333 Thanks )

**@⁠Nmzik** on GitHub · 2026-10-07 20:56 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1163#issuecomment-6046701581) @⁠Nawid3333 Thanks )
This discussion has been locked. Commenting is limited to contributors.
No description provided.