diff options
author | Anders Carlsson <andersca@mac.com> | 2010-04-24 22:02:54 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-04-24 22:02:54 +0000 |
commit | c795750b29c923b3bb08eb8b93a44f1bc7646e98 (patch) | |
tree | 7cca08b217a2a9827a5dace05db7991a7d5149e5 /lib/Sema/SemaDeclCXX.cpp | |
parent | a88ad5618fcb07c5374c79d6781a33234984b039 (diff) |
When building implicit base initializers, add a derived-to-base cast that points to the exact base specifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102277 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 6d1d1070fd..d7cbc17a7a 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1502,6 +1502,13 @@ BuildImplicitBaseInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, DeclRefExpr::Create(SemaRef.Context, 0, SourceRange(), Param, SourceLocation(), ParamType, 0); + // Cast to the base class to avoid ambiguities. + CXXBaseSpecifierArray BasePath; + BasePath.push_back(BaseSpec); + SemaRef.ImpCastExprToType(CopyCtorArg, BaseSpec->getType(), + CastExpr::CK_UncheckedDerivedToBase, + /*isLvalue=*/true, BasePath); + InitializationKind InitKind = InitializationKind::CreateDirect(Constructor->getLocation(), SourceLocation(), SourceLocation()); |