aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-01-31 18:34:51 +0000
committerAnders Carlsson <andersca@mac.com>2010-01-31 18:34:51 +0000
commit3aba09376c5f49c4c8d176109ea4835bc2c528ee (patch)
tree9327456a19ee39fa56e2de8df8f77f2313b6f8b7 /lib/Sema/SemaInit.cpp
parent093802675b1548f2a5f44c29938d65cce00d58bb (diff)
Start creating CXXBindReferenceExpr nodes when binding complex types to references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94964 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaInit.cpp')
-rw-r--r--lib/Sema/SemaInit.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index a9adb70050..db888a62a4 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -3297,15 +3297,31 @@ InitializationSequence::Perform(Sema &S,
// Check exception specifications
if (S.CheckExceptionSpecCompatibility(CurInitExpr, DestType))
return S.ExprError();
+
+ // FIXME: We should do this for all types.
+ if (DestType->isAnyComplexType()) {
+ CurInit =
+ S.Owned(CXXBindReferenceExpr::Create(S.Context,
+ CurInit.takeAs<Expr>(),
+ /*ExtendsLifetime=*/false,
+ /*RequiresTemporaryCopy=*/false));
+ }
+
break;
-
+
case SK_BindReferenceToTemporary:
// Check exception specifications
if (S.CheckExceptionSpecCompatibility(CurInitExpr, DestType))
return S.ExprError();
- // FIXME: At present, we have no AST to describe when we need to make a
- // temporary to bind a reference to. We should.
+ // FIXME: We should do this for all types.
+ if (DestType->isAnyComplexType()) {
+ CurInit =
+ S.Owned(CXXBindReferenceExpr::Create(S.Context,
+ CurInit.takeAs<Expr>(),
+ /*ExtendsLifetime=*/false,
+ /*RequiresTemporaryCopy=*/true));
+ }
break;
case SK_UserConversion: {