[clang] [NFC][Clang] Fix potential deref of end iterator (PR #70193)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 27 22:10:24 PDT 2023


================
@@ -65,7 +65,7 @@ class CXXFieldCollector {
 
   /// getCurFields - Pointer to array of fields added to the currently parsed
   /// class.
-  FieldDecl **getCurFields() { return &*(Fields.end() - getCurNumFields()); }
----------------
shafik wrote:

I think this is basically [cwg232](https://wg21.link/cwg232) this is ok b/c we are not doing an lvalue-to-rvalue conversion but only using it to take the address of. 

CC @zygoloid 

https://github.com/llvm/llvm-project/pull/70193


More information about the cfe-commits mailing list