Skip to content

build: opt-in C++20 (MINIO_CPP_STD=20) to unlock span/format/coroutines #222

@harshavardhana

Description

@harshavardhana

Problem

Default is `MINIO_CPP_STD=17` (`CMakeLists.txt:54`). That blocks several modernization wins:

Suggested approach

Don't force the upgrade — make it opt-in:

```cmake
set(MINIO_CPP_STD "17" CACHE STRING "C++ standard (17 or 20)")
```

Then guard the C++20-only paths with `#if __cplusplus >= 202002L` (the codebase already has one such guard at `include/miniocpp/utils.h:173` for `operator<=>`).

Public API stays C++17-compatible by default. C++20 builds get the extras.

Impact

Enabling change. No perf/correctness improvement by itself — but unblocks #217 Phase 2, span-based buffer APIs, and potentially #222 (`std::expected` is C++23 but `tl::expected` is C++17 — so #222 doesn't strictly require this).

Roadmap

Tier 3 item from the C++ modernization audit.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions