Skip to content

feat: make the public headers consumable as C++20 - #936

Open
PingLiuPing wants to merge 11 commits into
apache:mainfrom
PingLiuPing:cxx20-public-headers
Open

PingLiuPing wants to merge 11 commits into
apache:mainfrom
PingLiuPing:cxx20-public-headers

Conversation

@PingLiuPing

Copy link
Copy Markdown

Enable C++20 consumers to include and use iceberg-cpp’s installed public headers while keeping iceberg-cpp implementation code and internal workflows on C++23.

Restore the vendored iceberg::expected backport — brings back src/iceberg/expected.h from #40 (removed by #139), with its test and LICENSE entry. unexpected's comparison operators now go through error().

Built and ran public_headers_cxx20 as an external C++20 package consumer; all 199 installed public headers compiled and linked.

Fix #928

@zhjwpku

zhjwpku commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

It seems there are some conflicts, please rebase the main branch.

Comment thread example/CMakeLists.txt

project(example)

set(CMAKE_CXX_STANDARD 23)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make C++23 still as default and let it accept user supplied option so that C++20 can be test manually locally.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhjwpku Thank you for the comments.

Making it configurable is a good idea. Have different thoughts on making C++23 as default though.

With this patch, it changes the minimum supported C++ standard from C++23 to C++20 for downstream consumers. And C++20 is the interface contract between the consumer and iceberg-cpp library, and the contract should be tested continuously.

Setting the default to C++20 ensures the minimum supported standard (contract) is continuously exercised. Defaulting it to C++23 would let C++20 only breakages slip through.

One refinement is that C++23 compatibility should still be tested separately. C++23 should accepts C++20 code, but we can enhance this by provide an optional example configuration for C++23, for example, expose an ICEBERG_EXAMPLE_CXX_STANDARD cache setting that defaults to 20 and accepts 23; then update CI to build both.
And also refine the document to state clearly that the minimum C++ standard is C++20 for public headers. What do you think?

Happy to make changes either way.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense to me, I think we should build both for compatibility purpose.

@wgtmac
wgtmac requested a review from manuzhang September 17, 2026 06:50
Comment thread src/iceberg/expected.h
@@ -0,0 +1,2401 @@
/*

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to put this file here? It will be better placed in a third_lib directory and a README to explain its purpose.

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.

Public headers require C++23, forcing the same on every consumer

3 participants