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 | af13c7bea94f9795cf6ea8b213e4821439ccf8b0 (patch) | |
| tree | 2e99ee9ee55a26084e7bbba2a73d5bb207ecf240 /clang/lib/Sema/SemaDeclCXX.cpp | |
| parent | 9a7459af1da2f671c8e0d60136bf9e8ad0c46b71 (diff) | |
| download | bcm5719-llvm-af13c7bea94f9795cf6ea8b213e4821439ccf8b0.tar.gz bcm5719-llvm-af13c7bea94f9795cf6ea8b213e4821439ccf8b0.zip | |
When building implicit base initializers, add a derived-to-base cast that points to the exact base specifier.
llvm-svn: 102277
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 6d1d1070fdb..d7cbc17a7a5 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/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()); |

