Disallow formatting of wchar_t when using a char formatter.

This commit is contained in:
Victor Zverovich
2013-12-07 08:12:03 -08:00
parent 206c846e12
commit e3b4a3f166
3 changed files with 35 additions and 15 deletions

View File

@@ -396,13 +396,14 @@ inline const typename fmt::BasicFormatter<Char>::Arg
template <typename Char>
void fmt::BasicFormatter<Char>::CheckSign(const Char *&s, const Arg &arg) {
char sign = *s;
if (arg.type > LAST_NUMERIC_TYPE) {
ReportError(s,
Format("format specifier '{0}' requires numeric argument") << *s);
Format("format specifier '{}' requires numeric argument") << sign);
}
if (arg.type == UINT || arg.type == ULONG || arg.type == ULONG_LONG) {
ReportError(s,
Format("format specifier '{0}' requires signed argument") << *s);
Format("format specifier '{}' requires signed argument") << sign);
}
++s;
}