forked from OSchip/llvm-project
Fix the AST tree so ir-gen can do the conversion via copy construction.
Fixed pr5050. llvm-svn: 82783
This commit is contained in:
parent
1dbb8f78a3
commit
5aec1b54bc
|
@ -1113,7 +1113,9 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
|
|||
if (SCS.CopyConstructor) {
|
||||
// FIXME: When can ToType be a reference type?
|
||||
assert(!ToType->isReferenceType());
|
||||
|
||||
if (SCS.Second == ICK_Derived_To_Base)
|
||||
ImpCastExprToType(From, ToType, CastExpr::CK_DerivedToBase,
|
||||
/*isLvalue=*/true);
|
||||
OwningExprResult FromResult =
|
||||
BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(),
|
||||
ToType, SCS.CopyConstructor,
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s &&
|
||||
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s &&
|
||||
// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s &&
|
||||
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s &&
|
||||
// RUN: true
|
||||
|
||||
struct A { A(const A&); };
|
||||
|
||||
struct B : A { };
|
||||
|
||||
A f(const B &b) {
|
||||
return b;
|
||||
}
|
||||
|
||||
// CHECK-LP64: call __ZN1AC1ERK1A
|
||||
|
||||
// CHECK-LP32: call L__ZN1AC1ERK1A
|
||||
|
||||
|
Loading…
Reference in New Issue