Skip to content

Restore anti-slicing guard on operator_overload_set - #368

Merged
jbcoe merged 8 commits into
mainfrom
jbcoe-restore-operator-overload-set-guard
Sep 13, 2026
Merged

jbcoe merged 8 commits into
mainfrom
jbcoe-restore-operator-overload-set-guard

Conversation

@jbcoe

@jbcoe jbcoe commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Fixes @philipcraig 's review comment on operator_thunks.hh:243 (PR #355): operator_overload_set had public defaulted special members, so it could be sliced through a non-view pointer and read garbage.

@jbcoe
jbcoe marked this pull request as ready for review September 12, 2026 19:30
@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.79%. Comparing base (31d7c3c) to head (26017c2).

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           
Flag Coverage Δ
consteval 100.00% <ø> (ø)
runtime 72.39% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jbcoe
jbcoe added this pull request to stack #362 September 12, 2026 20:29
@jbcoe
jbcoe removed this pull request from stack #362 September 12, 2026 22:29
@jbcoe
jbcoe added this pull request to stack #370 September 12, 2026 22:29
@jbcoe
jbcoe requested a review from philipcraig September 12, 2026 22:29
@jbcoe
jbcoe removed this pull request from stack #370 September 12, 2026 22:34
@jbcoe
jbcoe added this pull request to stack #371 September 12, 2026 22:46

@philipcraig philipcraig left a comment

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.

Second-round pass over the whole stack (#336#369). This PR seals the overload sets, but the class that does the this cast is still open; details inline.

Comment thread operator_thunks.hh
Comment thread protocol_test.cc
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch from b35abdb to 6ccfb5c Compare September 13, 2026 13:37
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch from 6ccfb5c to 583a1de Compare September 13, 2026 14:19
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch from 583a1de to 26017c2 Compare September 13, 2026 14:23
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch from 26017c2 to 79a7a2d Compare September 13, 2026 15:27
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch 2 times, most recently from edd68e2 to 1fedce0 Compare September 13, 2026 15:33
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch from 1fedce0 to 67aee60 Compare September 13, 2026 15:34
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch from 67aee60 to 283e4d8 Compare September 13, 2026 15:37
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch from 283e4d8 to d69a76e Compare September 13, 2026 15:37
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch from d69a76e to 2d91544 Compare September 13, 2026 15:38
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch from 954d72e to 12b1e0c Compare September 13, 2026 15:44
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch 2 times, most recently from 61d057f to 75edf53 Compare September 13, 2026 15:47
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch from 75edf53 to b9d475e Compare September 13, 2026 15:49
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch from b9d475e to 77bb576 Compare September 13, 2026 15:51
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch from 77bb576 to 17d09fd Compare September 13, 2026 15:52
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch from 17d09fd to 07d0dc0 Compare September 13, 2026 15:52
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch from 07d0dc0 to e7de23e Compare September 13, 2026 15:53
@jbcoe
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch from e7de23e to 90f0937 Compare September 13, 2026 15:54
Base automatically changed from jbcoe-reject-binary-operator-star to main September 13, 2026 15:54
jbcoe and others added 8 commits September 13, 2026 09:54
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
jbcoe force-pushed the jbcoe-restore-operator-overload-set-guard branch from 90f0937 to 3367cc9 Compare September 13, 2026 15:54
@jbcoe
jbcoe merged commit d4668ee into main Sep 13, 2026
0 of 8 checks passed
@jbcoe
jbcoe deleted the jbcoe-restore-operator-overload-set-guard branch September 13, 2026 15:55
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.

2 participants