jcking1034 marked an inline comment as done. jcking1034 added inline comments.
================ Comment at: clang/include/clang/AST/ASTTypeTraits.h:472 + assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind)); + return *static_cast<const T *>(reinterpret_cast<const BaseT *>(Storage)); + } ---------------- sbenza wrote: > The create/get don't seem to match. > We are constructing a `BaseT` object in `create()`, so this `static_cast` to > a derived type is UB? > That memory does not contain a `T`. > > If we instead construct a `T` in `create()`, we should be able to read it as > a `BaseT*` (assuming `is_pointer_interconvertible_base_of<BaseT, T>` is true) Done, constructing a `T` instead of a `BaseT` seems to work! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110586/new/ https://reviews.llvm.org/D110586 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits