Restore anti-slicing guard on operator_overload_set - #368
Merged
Merged
Conversation
jbcoe
marked this pull request as ready for review
September 12, 2026 19:30
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## jbcoe-reject-binary-operator-star #368 +/- ##
==================================================================
Coverage 72.79% 72.79%
==================================================================
Files 12 12
Lines 838 838
Branches 221 221
==================================================================
Hits 610 610
Misses 22 22
Partials 206 206
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jbcoe
added this pull request to stack #362
September 12, 2026 20:29
jbcoe
removed this pull request from stack #362
September 12, 2026 22:29
jbcoe
added this pull request to stack #370
September 12, 2026 22:29
jbcoe
removed this pull request from stack #370
September 12, 2026 22:34
jbcoe
added this pull request to stack #371
September 12, 2026 22:46
philipcraig
reviewed
Sep 13, 2026
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
from
September 13, 2026 13:37
b35abdb to
6ccfb5c
Compare
philipcraig
approved these changes
Sep 13, 2026
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
from
September 13, 2026 14:19
6ccfb5c to
583a1de
Compare
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
from
September 13, 2026 14:23
583a1de to
26017c2
Compare
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
from
September 13, 2026 15:27
26017c2 to
79a7a2d
Compare
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
2 times, most recently
from
September 13, 2026 15:33
edd68e2 to
1fedce0
Compare
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
from
September 13, 2026 15:34
1fedce0 to
67aee60
Compare
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
from
September 13, 2026 15:37
67aee60 to
283e4d8
Compare
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
from
September 13, 2026 15:37
283e4d8 to
d69a76e
Compare
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
from
September 13, 2026 15:38
d69a76e to
2d91544
Compare
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
from
September 13, 2026 15:44
954d72e to
12b1e0c
Compare
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
2 times, most recently
from
September 13, 2026 15:47
61d057f to
75edf53
Compare
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
from
September 13, 2026 15:49
75edf53 to
b9d475e
Compare
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
from
September 13, 2026 15:51
b9d475e to
77bb576
Compare
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
from
September 13, 2026 15:52
77bb576 to
17d09fd
Compare
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
from
September 13, 2026 15:52
17d09fd to
07d0dc0
Compare
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
from
September 13, 2026 15:53
07d0dc0 to
e7de23e
Compare
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
from
September 13, 2026 15:54
e7de23e to
90f0937
Compare
operator_thunk only specialised the nullary R(*)() form for op_star, so
an interface with a binary operator* (e.g. `Vec operator*(double) const`)
never matched a partial specialisation and fell through to the deleted
primary template, producing an opaque error deep inside
operator_overload_set instead of a clear diagnostic. Binary operator*
support is deferred; for now, reject it explicitly in
protocol_interface_function_infos, next to the ref-qualified check, so
the error surfaces at the interface.
The arity check excludes an explicit object parameter ("deducing this")
so a unary operator* declared that way isn't misclassified as binary.
Addresses philipcraig's review comment on conformance.hh:146 in #355.
e6d30c2 (#347, "Make operator_thunk generic to simplify friendship") dropped the protected special members that stopped operator_overload_set being sliced off through a non-view pointer, while renaming call_operator_overload_set to the now-generic operator_overload_set. Restore them on all four operator specialisations, and add CallOperatorOverloadSetCannotBeDetached tests for protocol and protocol_view alongside the existing MemberThunksCannotBeDetached ones, covering the slicing repro from the review comment. Addresses philipcraig's review comment on operator_thunks.hh:243 in #355.
jbcoe
force-pushed
the
jbcoe-restore-operator-overload-set-guard
branch
from
September 13, 2026 15:54
90f0937 to
3367cc9
Compare
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.
Fixes @philipcraig 's review comment on operator_thunks.hh:243 (PR #355):
operator_overload_sethad public defaulted special members, so it could be sliced through a non-view pointer and read garbage.