зеркало из https://github.com/microsoft/clang.git
Extend the deduced/actual argument type checking of C++
[temp.deduct.call]p4 to the deduction performed for 'auto', finishing the fix for PR9233. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133239 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
b165ed7f28
Коммит
9a636e8403
|
@ -3346,6 +3346,17 @@ Sema::DeduceAutoType(TypeSourceInfo *Type, Expr *Init,
|
|||
return false;
|
||||
|
||||
Result = SubstituteAutoTransform(*this, DeducedType).TransformType(Type);
|
||||
|
||||
// Check that the deduced argument type is compatible with the original
|
||||
// argument type per C++ [temp.deduct.call]p4.
|
||||
if (Result &&
|
||||
CheckOriginalCallArgDeduction(*this,
|
||||
Sema::OriginalCallArg(FuncParam,0,InitType),
|
||||
Result->getType())) {
|
||||
Result = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,7 @@ void f() {
|
|||
|
||||
auto *fail1 = 0; // expected-error {{variable 'fail1' with type 'auto *' has incompatible initializer of type 'int'}}
|
||||
int **p;
|
||||
// FIXME: due to PR9233, we get the wrong diagnostic here.
|
||||
const auto **fail2(p); // desired-error {{variable 'fail2' with type 'auto const **' has incompatible initializer of type 'int **'}} expected-error {{cannot initialize}}
|
||||
const auto **fail2(p); // expected-error {{variable 'fail2' with type 'auto const **' has incompatible initializer of type 'int **'}}
|
||||
}
|
||||
|
||||
struct S {
|
||||
|
|
Загрузка…
Ссылка в новой задаче