tests: fix the DirectStorage file read check build on MSVC 19.42 #1589

Manually merged
github merged 1 commit from gh-pr/1589/head into gh-pr/1589/base 2026-11-26 23:19:01 +00:00
Owner

@⁠SimSalabimse on GitHub · 2026-11-24 14:39 UTC · original
SimSalabimse:x2w-dstorage-c2664 → main · +1 −1 · 1 files · 1 commits · merged 2026-11-24 14:47 UTC

Change

tests/startup_dstorage_file_read_check.cpp:102 (added in #1493) does not compile on MSVC 19.42. The conditional alias ? low_alias.bytes : above_4g.bytes decays to const unsigned char *, and read() takes const unsigned char (&)[4]:

tests/startup_dstorage_file_read_check.cpp(102): error C2664: 'void `anonymous-namespace'::read(const char *,HANDLE,uint64_t,const unsigned char (&)[4])': cannot convert argument 4 from 'const unsigned char *' to 'const unsigned char (&)[4]'

The call now selects a pointer to the array and dereferences it, so the reference binds to the chosen unsigned char[4]. Test behaviour is unchanged.

Verification

Windows 11 26200, MSVC 19.42.34435 (VS 2022).

Before: cmake --build --preset dev exited 1 with the C2664 above.

After:

  • cmake --build --preset dev: exit 0
  • cmake --preset release and cmake --build --preset release: exit 0
  • ctest --preset dev --no-tests=error -R "dstorage" --output-on-failure: exit 0
  • ctest --preset release --no-tests=error -R "dstorage" --output-on-failure: exit 0

AI-assisted (Grok Build)

**@⁠SimSalabimse** on GitHub · 2026-11-24 14:39 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1589) `SimSalabimse:x2w-dstorage-c2664` → `main` · +1 −1 · 1 files · 1 commits · merged 2026-11-24 14:47 UTC ## Change `tests/startup_dstorage_file_read_check.cpp:102` (added in #1493) does not compile on MSVC 19.42. The conditional `alias ? low_alias.bytes : above_4g.bytes` decays to `const unsigned char *`, and `read()` takes `const unsigned char (&)[4]`: ``` tests/startup_dstorage_file_read_check.cpp(102): error C2664: 'void `anonymous-namespace'::read(const char *,HANDLE,uint64_t,const unsigned char (&)[4])': cannot convert argument 4 from 'const unsigned char *' to 'const unsigned char (&)[4]' ``` The call now selects a pointer to the array and dereferences it, so the reference binds to the chosen `unsigned char[4]`. Test behaviour is unchanged. ## Verification Windows 11 26200, MSVC 19.42.34435 (VS 2022). Before: `cmake --build --preset dev` exited 1 with the C2664 above. After: - `cmake --build --preset dev`: exit 0 - `cmake --preset release` and `cmake --build --preset release`: exit 0 - `ctest --preset dev --no-tests=error -R "dstorage" --output-on-failure`: exit 0 - `ctest --preset release --no-tests=error -R "dstorage" --output-on-failure`: exit 0 AI-assisted (Grok Build)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:18:59 +00:00
github manually merged commit 79f41db81c into gh-pr/1589/base 2026-11-26 23:19:01 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 14:50 UTC · original · reviewed

Reviewed commit 79f41db81c0cb30895e91d4bca1f8e1237f112d6 (tests: fix the DirectStorage file read check build on MSVC 19.42). No defects found.

Technical review

  • tests/startup_dstorage_file_read_check.cpp: Replaces alias ? low_alias.bytes : above_4g.bytes with *(alias ? &low_alias.bytes : &above_4g.bytes), avoiding array-to-pointer decay in the ternary expression so the result remains const unsigned char (&)[4] for read(...).

Verification

  • Linux:
    • python3 tests/docs_links_check.py — passed (16 Markdown files, 344 links).
    • python3 tests/bidi_controls_check.py — passed (1254 files).
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207):
    • Debug (--preset dev, startup_dstorage_file_read_check): 2/2 passed (startup_dstorage_file_read 0.01s, startup_dstorage_file_read_alias_control 0.01s).
    • Release /O2 (--preset release, startup_dstorage_file_read_check): 2/2 passed (startup_dstorage_file_read 0.01s, startup_dstorage_file_read_alias_control 0.01s).

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-24 14:50 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1589#pullrequestreview-6041498602) · **reviewed** Reviewed commit `79f41db81c0cb30895e91d4bca1f8e1237f112d6` (`tests: fix the DirectStorage file read check build on MSVC 19.42`). No defects found. ### Technical review - **`tests/startup_dstorage_file_read_check.cpp`**: Replaces `alias ? low_alias.bytes : above_4g.bytes` with `*(alias ? &low_alias.bytes : &above_4g.bytes)`, avoiding array-to-pointer decay in the ternary expression so the result remains `const unsigned char (&)[4]` for `read(...)`. ### Verification - **Linux**: - `python3 tests/docs_links_check.py` — passed (16 Markdown files, 344 links). - `python3 tests/bidi_controls_check.py` — passed (1254 files). - **Windows Server 2025 (Build 26100, MSVC 14.44.35207)**: - Debug (`--preset dev`, `startup_dstorage_file_read_check`): **2/2 passed** (`startup_dstorage_file_read` `0.01s`, `startup_dstorage_file_read_alias_control` `0.01s`). - Release `/O2` (`--preset release`, `startup_dstorage_file_read_check`): **2/2 passed** (`startup_dstorage_file_read` `0.01s`, `startup_dstorage_file_read_alias_control` `0.01s`). AI-assisted; commands listed were executed locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.