fix: explicitly check operator[] in is_contiguous#4825
Merged
Conversation
vitaut
requested changes
Jun 24, 2026
vitaut
left a comment
Contributor
There was a problem hiding this comment.
LGTM but please add a test case to base-test.
Prevent false positives when the container itself does not have `operator[](size_t)`, but the target type of one of the non-explicit user-defined conversion functions does.
d21f151 to
28a50d5
Compare
vitaut
requested changes
Jun 25, 2026
vitaut
left a comment
Contributor
There was a problem hiding this comment.
Mostly looks good, just two minor comments.
|
|
||
| using value_type = char; | ||
|
|
||
| FMT_NODISCARD auto size() const noexcept -> size_t { return buffer_.size(); } |
Contributor
There was a problem hiding this comment.
FMT_NODISCARD is not needed, this is just a test. Also please apply clang-format.
Contributor
Author
There was a problem hiding this comment.
f07287f I didn't notice the incorrect format because the CI passed. Weird.
|
|
||
| struct phantom_subscript_operator_container | ||
| { | ||
| std::vector<char> buffer_; |
Contributor
There was a problem hiding this comment.
buffer_ -> buffer since it is a public member.
Contributor
|
Merged, thanks |
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.
Prevent false positives when the container itself does not have
operator[](size_t), but the target type of one of the non-explicit user-defined conversion functionsdoeshas a built-in subscript operator. Edit: corrected wordingExample: https://godbolt.org/z/53bqcn97W
Error message