[PATCH] D75285: Mark restrict pointer or reference to const as invariant

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 27 20:42:03 PST 2020


yaxunl added a comment.

In D75285#1896458 <https://reviews.llvm.org/D75285#1896458>, @rjmccall wrote:

> Unfortunately, `const` also doesn't mean that the memory doesn't change.   It does mean it can't be changed through this pointer, but `restrict` allows you to derive more pointers from it within the `restrict` scope, and those pointers can remove the `const` qualifier.


If users derive a non-const pointer from the const pointer and modify it, doesn't that result in UB? Thanks.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75285/new/

https://reviews.llvm.org/D75285





More information about the cfe-commits mailing list