[PATCH] D142384: [C++20] Fix a crash with modules.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 31 13:03:12 PST 2023


rsmith added inline comments.


================
Comment at: clang/include/clang/AST/DeclCXX.h:557-560
+  RecordDecl::field_iterator field_begin() const {
+    assert(hasDefinition() && "Definition not available to get fields.");
+    return static_cast<const RecordDecl *>(getDefinition())->field_begin();
+  }
----------------
This change makes me nervous: calling `field_begin` / `fields` on a `CXXRecordDecl*` will now work, but calling those same functions on the same object that has been cast to `RecordDecl*` will still be broken. Can we change the accessors in the base class instead?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142384



More information about the cfe-commits mailing list