pro_backend: fix macOS build of the C response holders - #120
Merged
jagerman merged 1 commit intoAug 6, 2026
Conversation
GetProRevocationsCResponse and GetPaymentDetailsCResponse are aggregates deriving from their C++ response, and the matching *_parse functions build them with std::make_unique from a parsed base response. make_unique initializes with parentheses, so that only works where the compiler implements P0960R3 (parenthesized aggregate initialization, C++20). GCC does, which is why the Linux builds are green, but the Apple Clang on the macOS CI runners does not -- it looks for a constructor, finds none, and fails with "no matching constructor for initialization of GetProRevocationsCResponse". Give each holder an explicit base-slice constructor so the call sites resolve to a real constructor on every compiler. The defaulted default constructor is kept because set_c_protocol_error<Owned> default-constructs these to carry a diagnostic.
jagerman
pushed a commit
that referenced
this pull request
Aug 6, 2026
Forward-port of #120 (dev commit b63b4b0) onto pfs; applies unmodified. GetProRevocationsCResponse / GetPaymentDetailsCResponse are aggregates built by the *_parse functions via std::make_unique from a parsed base response. make_unique initializes with parentheses, which only aggregate-initializes under P0960R3 (C++20): GCC implements it, the Apple Clang on the macOS CI runners does not, so it looks for a constructor and finds none. Give each an explicit base-slice constructor; call sites are unchanged. pfs has the same structs and the same make_unique call sites, so it has the same latent macOS break.
jagerman
added a commit
that referenced
this pull request
Aug 6, 2026
Records dev up to 2b27d27 as merged, keeping pfs's tree unchanged (-s ours). All four PRs in the range are now applied to pfs: - #116 (this-is-not-c) via #115 this-is-not-c-pfs - #118 (renewal-target-no-proof-fetch) via #119 renewal-target-no-proof-fetch-pfs - #120 (macOS C response holders) forward-ported in e682e6b - #114 (fixed-size XEd25519 spans) forward-ported in b03709d Verified for the two that were already applied: #119's user_profile.cpp change is line-identical to #118's, and for #116/#115 the `errs` error-vector is gone from both branches with identical parse_error usage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The macOS jobs fail to compile
src/pro_backend.cppwhile Linux is green:Same failure for
GetPaymentDetailsCResponse. Seen on the Xcode 15.4 runners, e.g. https://github.com/session-foundation/libsession-util-nodejs/actions/runs/31062340831/job/92492725217?pr=66Cause
GetProRevocationsCResponse/GetPaymentDetailsCResponseare aggregates deriving from their C++ response type, and the*_parsefunctions build them straight from a parsed base response:std::make_unique<GetProRevocationsCResponse>(parse_revocations({json, json_len}));make_uniqueinitializes with parentheses (new T(args...)), so initializing an aggregate that way requires P0960R3 (parenthesized aggregate initialization, C++20). GCC implements it — hence green Linux builds — but the Apple Clang on the macOS runners does not, so it looks for a constructor, finds only the implicit copy/move/default ones, and none accept a base-class argument.It is not a bad pin or a stale submodule: the code is only ever valid on compilers that have P0960.
Fix
Give each holder an explicit base-slice constructor, so the existing call sites resolve to a real constructor on every compiler. Call sites are unchanged.
The defaulted default constructor is kept deliberately —
set_c_protocol_error<Owned>default-constructs these to carry a diagnostic:auto owned = std::make_unique<Owned>();Declaring it
= defaulton first declaration keeps it non-user-provided, somake_unique<Owned>()still value-initializes exactly as it did while the type was an aggregate.Verification
-std=c++17(a faithful stand-in for a compiler without P0960, and it reproduces the identical "no matching constructor" diagnostic), compiles with the fix. Checked under both GCC 15 and Clang 21, at C++17 and C++20.src/pro_backend.cppsyntax-checks clean with the project's real compile flags fromcompile_commands.json.clang-formatreports no changes against the repo's.clang-format.I could not build on macOS directly, so the Apple Clang leg is inferred from the reduced repro rather than observed — worth letting CI confirm.