[cfe-commits] r153993 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.list/p6.cpp

John McCall rjmccall at apple.com
Tue Apr 3 19:40:27 PDT 2012


Author: rjmccall
Date: Tue Apr  3 21:40:27 2012
New Revision: 153993

URL: http://llvm.org/viewvc/llvm-project?rev=153993&view=rev
Log:
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.

Added:
    cfe/trunk/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.list/p6.cpp
Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=153993&r1=153992&r2=153993&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Tue Apr  3 21:40:27 2012
@@ -4433,6 +4433,8 @@
     else if (NumInits == 0) {
       Result.setStandard();
       Result.Standard.setAsIdentityConversion();
+      Result.Standard.setFromType(ToType);
+      Result.Standard.setAllToTypes(ToType);
     }
     Result.setListInitializationSequence();
     return Result;

Added: cfe/trunk/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.list/p6.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.list/p6.cpp?rev=153993&view=auto
==============================================================================
--- cfe/trunk/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.list/p6.cpp (added)
+++ cfe/trunk/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.list/p6.cpp Tue Apr  3 21:40:27 2012
@@ -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}}
+  }
+}





More information about the cfe-commits mailing list