"overloaded '%0' cannot be a static member function")
DIAG(err_operator_overload_default_arg, ERROR,
"parameter of overloaded '%0' cannot have a default argument")
-DIAG(err_operator_overload_must_be_unaryx, ERROR,
- "overloaded '%0' must be a unary operator (has %1 parameter%s1)")
-DIAG(err_operator_overload_must_be_binaryx, ERROR,
- "overloaded '%0' must be a binary operator (has %1 parameter%s1)")
-DIAG(err_operator_overload_must_be_unary_or_binaryx, ERROR,
- "overloaded '%0' must be a unary or binary operator (has %1 parameter%s1)")
+DIAG(err_operator_overload_must_be, ERROR,
+ "overloaded '%0' must be a %select{unary|binary|unary or binary}2 operator"
+ " (has %1 parameter%s1)")
DIAG(err_operator_overload_must_be_member, ERROR,
"overloaded '%0' must be a non-static member function")
DIAG(err_operator_overload_post_incdec_must_be_int, ERROR,
(NumParams == 2 && !CanBeBinaryOperator) ||
(NumParams < 1) || (NumParams > 2))) {
// We have the wrong number of parameters.
- diag::kind DK;
+ unsigned ErrorKind;
if (CanBeUnaryOperator && CanBeBinaryOperator) {
- DK = diag::err_operator_overload_must_be_unary_or_binaryx;
+ ErrorKind = 2; // 2 -> unary or binary.
} else if (CanBeUnaryOperator) {
- DK = diag::err_operator_overload_must_be_unaryx;
+ ErrorKind = 0; // 0 -> unary
} else {
assert(CanBeBinaryOperator &&
"All non-call overloaded operators are unary or binary!");
- DK = diag::err_operator_overload_must_be_binaryx;
+ ErrorKind = 1; // 1 -> binary
}
- return Diag(FnDecl->getLocation(), DK) << FnDecl->getName() << NumParams;
+ return Diag(FnDecl->getLocation(), diag::err_operator_overload_must_be)
+ << FnDecl->getName() << NumParams << ErrorKind;
}
// Overloaded operators other than operator() cannot be variadic.