Skip to content

fix: build with MSVC 14.42 (VS 2022 17.12) - #986

Open
rohanjain101 wants to merge 2 commits into
apache:mainfrom
rohanjain101:users/rohanjain/msvc-14.42-compat
Open

rohanjain101 wants to merge 2 commits into
apache:mainfrom
rohanjain101:users/rohanjain/msvc-14.42-compat

Conversation

@rohanjain101

Copy link
Copy Markdown

What

Make the sources compile with MSVC 14.42 (VS 2022 17.12). The README lists MSVC 2022+ as supported, but the
current sources fail to build with 14.42. Newer MSVC versions are unaffected. There is no functional change.

  • ParallelCollect (util/executor_util_internal.h) used a lambda in its requires-clause and lambdas expanded over
    a parameter pack. 14.42 rejects both (C3546/C2326/C3520). They are replaced with a class-template trait and helper
    function templates.
  • manifest_group.cc used a conditional operator over two move-only Result<ManifestEntryStreamPtr> prvalues.
    14.42 tries to copy them (C2280). The stream is now selected with if/else in a small helper.
  • snapshot_update.cc and merging_snapshot_update_test.cc used the C++23 0UZ literal, which 14.42 does not
    support (C3688). It is replaced with size_t{0}.
  • cache_test.cc used a lambda with a trailing return type and no parameter list ([&] -> Status). This is C++23
    syntax (P1102) that 14.42 rejects. The empty parameter list is added.

Why

vcpkg carries these changes as a downstream patch for 0.4.0 (microsoft/vcpkg#54315). Upstreaming them lets that
patch be dropped after the next release.

Testing

  • MSVC 14.51, static, Release, bundle enabled: full build succeeds and all 17 ctest suites pass, including
    util_test (ParallelCollect/executor and cache tests), scan_test, manifest_test and table_update_test.
  • MSVC 14.42 (19.42.34439): iceberg_static, iceberg_data_static and every changed source file, including the
    changed tests, now compile.
  • clang-format reports no changes for the modified files.

The README lists MSVC 2022+ as supported, but the sources do not compile
with MSVC 14.42. Newer MSVC versions are unaffected. This change makes no
functional change:

- ParallelCollect used a lambda in its requires-clause and lambdas expanded
  over a parameter pack, which 14.42 rejects (C3546/C2326/C3520). Replace
  them with a class-template trait and helper function templates.
- ManifestGroup used a conditional operator over two move-only
  Result<ManifestEntryStreamPtr> prvalues, which 14.42 tries to copy (C2280).
  Select the stream with if/else in a small helper instead.
- Replace the C++23 0UZ literal, which 14.42 does not support (C3688), with
  size_t{0}.
- Add the empty parameter list to a lambda with a trailing return type in
  cache_test.cc. Omitting it is C++23 syntax (P1102) that 14.42 rejects.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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