forked from OSchip/llvm-project
Make sure we don't crash printing builtin candidates for overloads of deleted operators. Fixes PR10757.
llvm-svn: 138645
This commit is contained in:
parent
318c9f2240
commit
79b2d3a4d4
|
@ -8525,8 +8525,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,
|
|||
<< UnaryOperator::getOpcodeStr(Opc)
|
||||
<< Input->getType()
|
||||
<< Input->getSourceRange();
|
||||
CandidateSet.NoteCandidates(*this, OCD_ViableCandidates,
|
||||
Args, NumArgs,
|
||||
CandidateSet.NoteCandidates(*this, OCD_ViableCandidates, Args, NumArgs,
|
||||
UnaryOperator::getOpcodeStr(Opc), OpLoc);
|
||||
return ExprError();
|
||||
|
||||
|
@ -8536,7 +8535,8 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,
|
|||
<< UnaryOperator::getOpcodeStr(Opc)
|
||||
<< getDeletedOrUnavailableSuffix(Best->Function)
|
||||
<< Input->getSourceRange();
|
||||
CandidateSet.NoteCandidates(*this, OCD_AllCandidates, Args, NumArgs);
|
||||
CandidateSet.NoteCandidates(*this, OCD_AllCandidates, Args, NumArgs,
|
||||
UnaryOperator::getOpcodeStr(Opc), OpLoc);
|
||||
return ExprError();
|
||||
}
|
||||
|
||||
|
@ -8831,7 +8831,8 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
|
|||
<< BinaryOperator::getOpcodeStr(Opc)
|
||||
<< getDeletedOrUnavailableSuffix(Best->Function)
|
||||
<< Args[0]->getSourceRange() << Args[1]->getSourceRange();
|
||||
CandidateSet.NoteCandidates(*this, OCD_AllCandidates, Args, 2);
|
||||
CandidateSet.NoteCandidates(*this, OCD_AllCandidates, Args, 2,
|
||||
BinaryOperator::getOpcodeStr(Opc), OpLoc);
|
||||
return ExprError();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
|
||||
|
||||
struct PR10757 {
|
||||
bool operator~() = delete; // expected-note {{explicitly deleted}}
|
||||
bool operator==(const PR10757&) = delete; // expected-note {{explicitly deleted}}
|
||||
operator float();
|
||||
};
|
||||
int PR10757f() {
|
||||
PR10757 a1;
|
||||
// FIXME: We get a ridiculous number of "built-in candidate" notes here...
|
||||
if(~a1) {} // expected-error {{overload resolution selected deleted operator}} expected-note 6 {{built-in candidate}}
|
||||
if(a1==a1) {} // expected-error {{overload resolution selected deleted operator}} expected-note 81 {{built-in candidate}}
|
||||
}
|
Loading…
Reference in New Issue