forked from OSchip/llvm-project
Simplify error messages for two-parameter overloaded increment/decrement operators
llvm-svn: 59442
This commit is contained in:
parent
77324f3854
commit
9edcc802c3
|
@ -1346,12 +1346,8 @@ DIAG(err_operator_overload_must_be_unary_or_binary_plural, ERROR,
|
|||
DIAG(err_operator_overload_must_be_member, ERROR,
|
||||
"overloaded operator '%0' must be a non-static member function")
|
||||
DIAG(err_operator_overload_post_inc_must_be_int, ERROR,
|
||||
"second parameter of overloaded post-increment operator must have type 'int' (not '%0')")
|
||||
DIAG(err_operator_overload_post_dec_must_be_int, ERROR,
|
||||
"second parameter of overloaded post-decrement operator must have type 'int' (not '%0')")
|
||||
DIAG(err_operator_overload_post_inc_must_be_int_member, ERROR,
|
||||
"parameter of overloaded post-increment operator must have type 'int' (not '%0')")
|
||||
DIAG(err_operator_overload_post_dec_must_be_int_member, ERROR,
|
||||
DIAG(err_operator_overload_post_dec_must_be_int, ERROR,
|
||||
"parameter of overloaded post-decrement operator must have type 'int' (not '%0')")
|
||||
DIAG(err_operator_missing_type_specifier, ERROR,
|
||||
"missing type specifier after 'operator'")
|
||||
|
|
|
@ -1987,17 +1987,10 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) {
|
|||
|
||||
if (!ParamIsInt) {
|
||||
diag::kind DK;
|
||||
if (Op == OO_PlusPlus) {
|
||||
if (MethodDecl)
|
||||
DK = diag::err_operator_overload_post_inc_must_be_int_member;
|
||||
else
|
||||
DK = diag::err_operator_overload_post_inc_must_be_int;
|
||||
} else {
|
||||
if (MethodDecl)
|
||||
DK = diag::err_operator_overload_post_dec_must_be_int_member;
|
||||
else
|
||||
DK = diag::err_operator_overload_post_dec_must_be_int;
|
||||
}
|
||||
if (Op == OO_PlusPlus)
|
||||
DK = diag::err_operator_overload_post_inc_must_be_int;
|
||||
else
|
||||
DK = diag::err_operator_overload_post_dec_must_be_int;
|
||||
Diag(LastParam->getLocation(), DK,
|
||||
Context.getCanonicalType(LastParam->getType()).getAsString(),
|
||||
SourceRange(FnDecl->getLocation()));
|
||||
|
|
|
@ -34,4 +34,4 @@ typedef int INT;
|
|||
typedef float FLOAT;
|
||||
Y& operator++(Y&);
|
||||
Y operator++(Y&, INT);
|
||||
X operator++(X&, FLOAT); // expected-error{{second parameter of overloaded post-increment operator must have type 'int' (not 'float')}}
|
||||
X operator++(X&, FLOAT); // expected-error{{parameter of overloaded post-increment operator must have type 'int' (not 'float')}}
|
||||
|
|
Loading…
Reference in New Issue