Test restrictions on taking addresses of members and variables. #284
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.
Checked C restricts taking the addresses of:
This add tests of restrictions 1-3, as part of implementing checkedc/checkedc-clang#213 and checkedc/checkedc-clang#212:
It is OK to take the address of an array variable or member because you can't use the resulting pointer to modify the pointer that the array converts to.
The trickier cases to test involve nested members. Given
we don't allow the addresses of
n
orn.len
to be taken. However, ifNestedLen
is not embedded inS
, we allow the address of a struct of type NestedLen to be taken.The matching compiler change is at checkedc/checkedc-clang#490.