From bd5bd4b36a207a98c8433462701e48a4aa5a05a4 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Mon, 14 Oct 2013 21:14:05 +0000 Subject: PR17576: Fix assertion on polymorphic classes with small alignment We have to reserve at least the width of a pointer for the vfptr. For classes with small alignment, we weren't reserving enough space, and were overlapping the first field with the vfptr. llvm-svn: 192626 --- clang/lib/AST/RecordLayoutBuilder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/AST/RecordLayoutBuilder.cpp') diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp index 05eeae154d0..b0230ac6ef6 100644 --- a/clang/lib/AST/RecordLayoutBuilder.cpp +++ b/clang/lib/AST/RecordLayoutBuilder.cpp @@ -2660,8 +2660,8 @@ void MicrosoftRecordLayoutBuilder::layoutVFPtr(const CXXRecordDecl *RD) { // the max alignment of all the non-virtual data in the class. The resulting // layout is essentially { vftbl, { nvdata } }. This is completely // unnecessary, but we're not here to pass judgment. - Size += Alignment; updateAlignment(PointerAlignment); + Size += Alignment; } void -- cgit v1.2.3