Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using C++23 builds with warning: std::aligned_storage is deprecated #3111

Closed
ColoredCarrot opened this issue Oct 25, 2024 · 0 comments · Fixed by #3112
Closed

Using C++23 builds with warning: std::aligned_storage is deprecated #3111

ColoredCarrot opened this issue Oct 25, 2024 · 0 comments · Fixed by #3112
Labels
bug Something isn't working

Comments

@ColoredCarrot
Copy link
Contributor

In C++23, std::aligned_storage was deprecated with P1413R3.

Using it leads to a compiler warning with MSVC:

api\include\opentelemetry\nostd\internal\absl\meta\type_traits.h(117,50): warning C4996: 'std::aligned_storage<_Len,_Align>': warning STL4034: std::aligned_storage and std::aligned_storage_t are deprecated in C++23. Prefer alignas(T) std::byte t_buff[sizeof(T)]. You can define _SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING or _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.

While std::aligned_storage isn't actually used for anything in opentelemetry-cpp or its dependencies, it is referenced in that one file: api/include/opentelemetry/nostd/internal/absl/meta/type_traits.h.

That file uses it to define the no-std version of aligned_storage_t, which doesn't appear to be used anywhere.

Proposal

Remove aligned_storage from nostd.
This is exactly what Abseil did as well, in abseil/abseil-cpp@4213346.

@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Oct 25, 2024
ColoredCarrot pushed a commit to ColoredCarrot/opentelemetry-cpp that referenced this issue Oct 25, 2024
std::aligned_storage was deprecated in C++23.
Abseil removed its aligned_storage in abseil/abseil-cpp@4213346
ColoredCarrot added a commit to ColoredCarrot/opentelemetry-cpp that referenced this issue Oct 25, 2024
std::aligned_storage was deprecated in C++23.
Abseil removed its aligned_storage in abseil/abseil-cpp@4213346
@marcalff marcalff added bug Something isn't working and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants