зеркало из https://github.com/microsoft/clang-1.git
Teach reference initialization from the result of a user-defined
conversion to initialize the standard conversion *after* the user-defined conversion properly. Fixes PR10644. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137608 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
2fd9a47487
Коммит
f20d27288c
|
@ -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"];
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче