diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-03-08 23:17:35 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-03-08 23:17:35 +0000 |
commit | bbbe6184678e6c0c159cfff1f24c95508a7708fa (patch) | |
tree | f8cc6e8adb2464cb1db150c441895c209c5290de /clang/lib/Sema/SemaAccess.cpp | |
parent | 6365e46459a0c181a7416a2d00c5a644bf2d2440 (diff) | |
download | llvm-bbbe6184678e6c0c159cfff1f24c95508a7708fa.zip llvm-bbbe6184678e6c0c159cfff1f24c95508a7708fa.tar.gz llvm-bbbe6184678e6c0c159cfff1f24c95508a7708fa.tar.bz2 |
Fix crash in access check for aggregate initialization of base classes. It's
not obvious how to access-check these, so pick a conservative rule until we get
feedback from CWG.
llvm-svn: 262966
Diffstat (limited to 'clang/lib/Sema/SemaAccess.cpp')
-rw-r--r-- | clang/lib/Sema/SemaAccess.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp index e9772bc..4bca2808 100644 --- a/clang/lib/Sema/SemaAccess.cpp +++ b/clang/lib/Sema/SemaAccess.cpp @@ -1670,8 +1670,12 @@ Sema::AccessResult Sema::CheckConstructorAccess(SourceLocation UseLoc, // Initializing a base sub-object is an instance method call on an // object of the derived class. Otherwise, we have an instance method // call on an object of the constructed type. + // + // FIXME: If we have a parent, we're initializing the base class subobject + // in aggregate initialization. It's not clear whether the object class + // should be the base class or the derived class in that case. CXXRecordDecl *ObjectClass; - if (Entity.getKind() == InitializedEntity::EK_Base) { + if (Entity.getKind() == InitializedEntity::EK_Base && !Entity.getParent()) { ObjectClass = cast<CXXConstructorDecl>(CurContext)->getParent(); } else { ObjectClass = NamingClass; |