JonChesterfield added a comment. In D75285#1897247 <https://reviews.llvm.org/D75285#1897247>, @yaxunl wrote:
> If users derive a non-const pointer from the const pointer and modify it, > doesn't that result in UB? Thanks. No. Modifying a const object is UB, so e.g. we can segv if it's in .rodata, but a const pointer is not necessarily a pointer to a const object. If it's a const pointer to a non-const object then one can cast it directly to a non-const pointer and mutate at will. This unfortunately makes 'const int*' of rather less use than it would otherwise be. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75285/new/ https://reviews.llvm.org/D75285 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits