[clang] Add an off-by-default warning to complain about MSVC bitfield padding (PR #117428)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 25 09:11:37 PDT 2025


================
@@ -19001,9 +19001,9 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl,
 
   // Verify that all the fields are okay.
   SmallVector<FieldDecl*, 32> RecFields;
-
+  std::optional<const FieldDecl *> PreviousField;
----------------
ojhunt wrote:

@rnk this is sufficiently constrained/non-escaping but in general I prefer optional<> to null pointers as there's no other signal to indicate whether a pointer can be legitimately null. (It would be nice if optional<&> was a thing :D )

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


More information about the cfe-commits mailing list