From: Anders Carlsson Date: Sat, 19 Dec 2009 02:13:41 +0000 (+0000) Subject: Correctly initialize the PrimaryBaseInfo if a base is null. Fixes PR5832. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29f1a6070ac35fcbea9241c843df7f3f7c5c3228;p=clang Correctly initialize the PrimaryBaseInfo if a base is null. Fixes PR5832. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91748 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/RecordLayout.h b/include/clang/AST/RecordLayout.h index a8334b6940..e8d1788ded 100644 --- a/include/clang/AST/RecordLayout.h +++ b/include/clang/AST/RecordLayout.h @@ -53,7 +53,7 @@ public: PrimaryBaseInfo() {} PrimaryBaseInfo(const CXXRecordDecl *Base, bool IsVirtual) - : Value(Base, IsVirtual) {} + : Value(Base, Base && IsVirtual) {} /// Value - Points to the primary base. The single-bit value /// will be non-zero when the primary base is virtual. diff --git a/test/CodeGenCXX/virtual-function-calls.cpp b/test/CodeGenCXX/virtual-function-calls.cpp index b927dec8f1..0b3a684301 100644 --- a/test/CodeGenCXX/virtual-function-calls.cpp +++ b/test/CodeGenCXX/virtual-function-calls.cpp @@ -9,3 +9,11 @@ void f(A *a) { // CHECK: call void % a->f('c'); } + +struct B : virtual A { + virtual void f(); +}; + +void f(B * b) { + b->f(); +} \ No newline at end of file