Skip to content

Fix build with C++20.#114

Open
bavshin-f5 wants to merge 1 commit into
nginx:mainfrom
bavshin-f5:c++20-explicit-span-ctor
Open

Fix build with C++20.#114
bavshin-f5 wants to merge 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});
      |         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~

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});
      |         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
```
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