[cfe-commits] r137608 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp

Douglas Gregor dgregor at apple.com
Mon Aug 15 06:59:46 PDT 2011


Author: dgregor
Date: Mon Aug 15 08:59:46 2011
New Revision: 137608

URL: http://llvm.org/viewvc/llvm-project?rev=137608&view=rev
Log:
Teach reference initialization from the result of a user-defined
conversion to initialize the standard conversion *after* the
user-defined conversion properly. Fixes PR10644.

Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp
    cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=137608&r1=137607&r2=137608&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Mon Aug 15 08:59:46 2011
@@ -3609,11 +3609,11 @@
     ICS.Standard.ObjCLifetimeConversionBinding = false;
   } else if (ICS.isUserDefined()) {
     ICS.UserDefined.After.ReferenceBinding = true;
-    ICS.Standard.IsLvalueReference = !isRValRef;
-    ICS.Standard.BindsToFunctionLvalue = T2->isFunctionType();
-    ICS.Standard.BindsToRvalue = true;
-    ICS.Standard.BindsImplicitObjectArgumentWithoutRefQualifier = false;
-    ICS.Standard.ObjCLifetimeConversionBinding = false;
+    ICS.UserDefined.After.IsLvalueReference = !isRValRef;
+    ICS.UserDefined.After.BindsToFunctionLvalue = T2->isFunctionType();
+    ICS.UserDefined.After.BindsToRvalue = true;
+    ICS.UserDefined.After.BindsImplicitObjectArgumentWithoutRefQualifier = false;
+    ICS.UserDefined.After.ObjCLifetimeConversionBinding = false;
   }
 
   return ICS;

Modified: cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp?rev=137608&r1=137607&r2=137608&view=diff
==============================================================================
--- cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp (original)
+++ cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp Mon Aug 15 08:59:46 2011
@@ -162,3 +162,18 @@
   }
 
 }
+
+namespace pr10644 {
+  struct string {
+    string(const char* __s);
+  };
+  class map {
+    int& operator[](const string& __k);
+  public:
+    int& operator[](const string&& __k);
+  };
+  void foo() {
+    static map key_map;
+    key_map["line"];
+  }
+}





More information about the cfe-commits mailing list