summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-04-04 23:09:20 +0000
committerDouglas Gregor <dgregor@apple.com>2012-04-04 23:09:20 +0000
commit0f5c1c01273dabe68a63127ee78d004310594b16 (patch)
tree2bc8c89da199efd111f8a786bbe5898a40d811b2 /clang/lib/Sema
parentbea0d04f8c7ca6512650464543779d851819d467 (diff)
downloadbcm5719-llvm-0f5c1c01273dabe68a63127ee78d004310594b16.tar.gz
bcm5719-llvm-0f5c1c01273dabe68a63127ee78d004310594b16.zip
Allow a conversion from the empty initializer list {} to an
std::initializer_list<T> so long as <T> is known. This conversion has identity rank. llvm-svn: 154065
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaOverload.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 7afa39f3f3b..e4c6fdfb59c 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -4301,6 +4301,16 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
ImplicitConversionSequence::Worse)
Result = ICS;
}
+
+ // For an empty list, we won't have computed any conversion sequence.
+ // Introduce the identity conversion sequence.
+ if (From->getNumInits() == 0) {
+ Result.setStandard();
+ Result.Standard.setAsIdentityConversion();
+ Result.Standard.setFromType(ToType);
+ Result.Standard.setAllToTypes(ToType);
+ }
+
Result.setListInitializationSequence();
Result.setStdInitializerListElement(toStdInitializerList);
return Result;
OpenPOWER on IntegriCloud