Skip to content

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

@ColoredCarrot

Description

@ColoredCarrot

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions