summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2012-02-19 12:27:56 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2012-02-19 12:27:56 +0000
commit99f66164701ffdf5fea16e9db26553d0636ae329 (patch)
treeefa0a1439b25fd4dcf4691e752d2b9a4fbfda859 /clang/lib/Sema
parent1d197174a2e6219544f259c98faef2d5089cc4c2 (diff)
downloadbcm5719-llvm-99f66164701ffdf5fea16e9db26553d0636ae329.tar.gz
bcm5719-llvm-99f66164701ffdf5fea16e9db26553d0636ae329.zip
Add a testcase for using objects with list-constructors, and fix a Sema crash by repeating an old hack.
llvm-svn: 150925
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaInit.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 28b99f9e4c3..1a62d246e4b 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -5109,8 +5109,9 @@ InitializationSequence::Perform(Sema &S,
// When an initializer list is passed for a parameter of type "reference
// to object", we don't get an EK_Temporary entity, but instead an
// EK_Parameter entity with reference type.
- // FIXME: This is a hack. Why is this necessary here, but not in other
- // places where implicit temporaries are created?
+ // FIXME: This is a hack. What we really should do is create a user
+ // conversion step for this case, but this makes it considerably more
+ // complicated. For now, this will do.
InitializedEntity TempEntity = InitializedEntity::InitializeTemporary(
Entity.getType().getNonReferenceType());
bool UseTemporary = Entity.getType()->isReferenceType();
@@ -5139,11 +5140,22 @@ InitializationSequence::Perform(Sema &S,
break;
}
- case SK_ConstructorInitialization:
- CurInit = PerformConstructorInitialization(S, Entity, Kind, move(Args),
- *Step,
+ case SK_ConstructorInitialization: {
+ // When an initializer list is passed for a parameter of type "reference
+ // to object", we don't get an EK_Temporary entity, but instead an
+ // EK_Parameter entity with reference type.
+ // FIXME: This is a hack. What we really should do is create a user
+ // conversion step for this case, but this makes it considerably more
+ // complicated. For now, this will do.
+ InitializedEntity TempEntity = InitializedEntity::InitializeTemporary(
+ Entity.getType().getNonReferenceType());
+ bool UseTemporary = Entity.getType()->isReferenceType();
+ CurInit = PerformConstructorInitialization(S, UseTemporary ? TempEntity
+ : Entity,
+ Kind, move(Args), *Step,
ConstructorInitRequiresZeroInit);
break;
+ }
case SK_ZeroInitialization: {
step_iterator NextStep = Step;
OpenPOWER on IntegriCloud