Skip to content

Conversation

patrykstefanski
Copy link

Check assignments to count-attributed objects that are implicitly immutable. For example, assigning to a dependent count that is used in an inout pointer is not allowed, since the update won't be visible on the call-site:

  void foo(int *__counted_by(count) *out_p, int count) {
    *out_p = ...;
    count = ...; // immutable
  }

rdar://161608157

(cherry picked from commit 7f73488)

…nt-attributed objects

Check assignments to count-attributed objects that are implicitly
immutable.  For example, assigning to a dependent count that is used in
an inout pointer is not allowed, since the update won't be visible on
the call-site:

```
  void foo(int *__counted_by(count) *out_p, int count) {
    *out_p = ...;
    count = ...; // immutable
  }
```

rdar://161608157

(cherry picked from commit 7f73488)
@patrykstefanski patrykstefanski self-assigned this Oct 17, 2025
@patrykstefanski patrykstefanski added the clang:bounds-safety Issue relating to the experimental -fbounds-safety feature in Clang label Oct 17, 2025
@patrykstefanski
Copy link
Author

@swift-ci test

@patrykstefanski
Copy link
Author

@swift-ci test llvm

1 similar comment
@patrykstefanski
Copy link
Author

@swift-ci test llvm

@patrykstefanski patrykstefanski merged commit ef7cbc7 into swiftlang:stable/21.x Oct 21, 2025
3 of 5 checks passed
@patrykstefanski patrykstefanski deleted the eng/pstefanski/PR-161608157-21.x branch October 21, 2025 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:bounds-safety Issue relating to the experimental -fbounds-safety feature in Clang

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant