[cfe-commits] r102277 - /cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Anders Carlsson
andersca at mac.com
Sat Apr 24 15:02:54 PDT 2010
Author: andersca
Date: Sat Apr 24 17:02:54 2010
New Revision: 102277
URL: http://llvm.org/viewvc/llvm-project?rev=102277&view=rev
Log:
When building implicit base initializers, add a derived-to-base cast that points to the exact base specifier.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=102277&r1=102276&r2=102277&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sat Apr 24 17:02:54 2010
@@ -1502,6 +1502,13 @@
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());
More information about the cfe-commits
mailing list