Skip to content

fix: replace deprecated std::aligned_storage_t (C++23 STL4034)#43

Merged
alandtse merged 1 commit into
masterfrom
fix/cxx23-aligned-storage-deprecation
Jun 2, 2026
Merged

fix: replace deprecated std::aligned_storage_t (C++23 STL4034)#43
alandtse merged 1 commit into
masterfrom
fix/cxx23-aligned-storage-deprecation

Conversation

@alandtse

@alandtse alandtse commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Problem

std::aligned_storage / std::aligned_storage_t are deprecated in C++23. The updated MSVC STL (rolling out on GitHub's windows-latestwindows-2025-vs2026 runners) now emits C4996 / STL4034 for the _storage member in RE::msvc::function (RE/msvc/functional.h:42).

This breaks every downstream consumer that compiles CommonLibF4 with warnings-as-errors. For example, Buffout4 sets /WX globally and its release build now fails:

RE\msvc\functional.h(42,8): error C2220: the following warning is treated as an error
warning C4996: 'std::aligned_storage_t': warning STL4034: std::aligned_storage and
std::aligned_storage_t are deprecated in C++23.

Fix

Replace std::aligned_storage_t<3 * sizeof(void*), alignof(long double)> with the MSVC-recommended alignas(long double) std::byte _storage[3 * sizeof(void*)].

The storage is byte-identical: 24 bytes, aligned to alignof(long double) (8), with _fn still at offset 0x18. The ABI mirror of std::_Func_class is unchanged. std::byte is already provided via the library PCH (<cstddef>).

🤖 Generated with Claude Code

std::aligned_storage and std::aligned_storage_t are deprecated in C++23.
Under the updated MSVC STL, C4996/STL4034 fires for the _storage member in
RE::msvc::function, which breaks downstream builds that treat warnings as
errors (e.g. Buffout4's /WX).

Replace it with the MSVC-recommended `alignas(T) std::byte buf[N]` form. The
layout is identical: 24 bytes aligned to alignof(long double), so the ABI
mirror of std::_Func_class is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@alandtse, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 50 minutes and 14 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4ed9ef7c-d19d-4040-a4b1-09eae43f7394

📥 Commits

Reviewing files that changed from the base of the PR and between ae3e301 and 67dce27.

📒 Files selected for processing (1)
  • CommonLibF4/include/RE/msvc/functional.h
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cxx23-aligned-storage-deprecation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@alandtse
alandtse merged commit 0a0a8df into master Jun 2, 2026
11 checks passed
@alandtse
alandtse deleted the fix/cxx23-aligned-storage-deprecation branch June 2, 2026 06:13
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.

1 participant