Skip to content

Fix build with C++20. - #114

Merged
p-pautov merged 1 commit into
nginx:mainfrom
bavshin-f5:c++20-explicit-span-ctor
Jun 4, 2026
Merged

Fix build with C++20.#114
p-pautov merged 1 commit into
nginx:mainfrom
bavshin-f5:c++20-explicit-span-ctor

Conversation

@bavshin-f5

Copy link
Copy Markdown
Member

OpenTelemetry SDK built with C++20 uses std::span in the API, and we want to match the standard to avoid type changes at the API boundary.

However, std::span constructor is explicit for non-default Extent, requiring us to use a more verbose specification instead of an initializer list.

src/trace_context.hpp:75:33: error: converting to ‘opentelemetry::v1::nostd::span<char, 32>’ {aka ‘std::span<char, 32>’} from initializer list would use explicit constructor ‘constexpr std::span<_Type, _Extent>::span(_It, size_type) [with _It = char*; _Type = char; long unsigned int _Extent = 32; size_type = long unsigned int]’
   75 |         tc.traceId.ToLowerBase16({out, kTraceIdSize});
      |         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~

Comment thread src/trace_context.hpp Outdated
OpenTelemetry SDK built with C++20 uses std::span in the API, and we
want to match the standard to avoid type changes at the API boundary.

However, std::span constructor is explicit for non-default Extent,
requiring us to use a more verbose specification instead of an
initializer list.
@bavshin-f5
bavshin-f5 force-pushed the c++20-explicit-span-ctor branch from 4968d0a to 8d8d584 Compare June 3, 2026 19:00
@p-pautov
p-pautov merged commit e3b6c98 into nginx:main Jun 4, 2026
2 checks passed
@bavshin-f5
bavshin-f5 deleted the c++20-explicit-span-ctor branch June 29, 2026 17:02
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.

2 participants