summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2012-04-04 02:40:27 +0000
committerJohn McCall <rjmccall@apple.com>2012-04-04 02:40:27 +0000
commitb73bc9af60367d5a0b11764082e561fade422194 (patch)
tree14bfbabfb70fa655a7858457e24c96d1ec465537 /clang
parenta995a47e38fae9fa60164c6692d8f5c4922fc175 (diff)
downloadbcm5719-llvm-b73bc9af60367d5a0b11764082e561fade422194.tar.gz
bcm5719-llvm-b73bc9af60367d5a0b11764082e561fade422194.zip
When computing the conversion sequence in overload resolution
for converting an empty list to a scalar, be sure to initialize the source and destination types so that comparison of conversion sequences will work in case there are multiple viable candidates. llvm-svn: 153993
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaOverload.cpp2
-rw-r--r--clang/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.list/p6.cpp15
2 files changed, 17 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 27b04a74272..7afa39f3f3b 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -4433,6 +4433,8 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
else if (NumInits == 0) {
Result.setStandard();
Result.Standard.setAsIdentityConversion();
+ Result.Standard.setFromType(ToType);
+ Result.Standard.setAllToTypes(ToType);
}
Result.setListInitializationSequence();
return Result;
diff --git a/clang/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.list/p6.cpp b/clang/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.list/p6.cpp
new file mode 100644
index 00000000000..ea059cef7c8
--- /dev/null
+++ b/clang/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.list/p6.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+// rdar://problem/11120365
+namespace test0 {
+ template <class T> struct A {
+ static void foo(const T &t) {}
+ static void foo(T &&t) {
+ t.foo(); // expected-error {{member reference base type 'int' is not a structure or union}}
+ }
+ };
+
+ void test() {
+ A<int>::foo({}); // expected-note {{requested here}}
+ }
+}
OpenPOWER on IntegriCloud