mirror of
https://github.com/intel/llvm.git
synced 2026-02-04 03:26:06 +08:00
Teach reference initialization from the result of a user-defined
conversion to initialize the standard conversion *after* the user-defined conversion properly. Fixes PR10644. llvm-svn: 137608
This commit is contained in:
@@ -3609,11 +3609,11 @@ TryReferenceInit(Sema &S, Expr *&Init, QualType DeclType,
|
||||
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;
|
||||
|
||||
@@ -162,3 +162,18 @@ namespace argument_passing {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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"];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user