@@ -1179,7 +1179,10 @@ constexpr bool BasicFormatString<StringType, ParameterTypes...>::validate_specif
1179
1179
}
1180
1180
1181
1181
// Validate the presentation type.
1182
- validate_type (*type, specifier);
1182
+ if (specifier.m_type != FormatSpecifier::Type::None)
1183
+ {
1184
+ validate_type (*type, specifier);
1185
+ }
1183
1186
1184
1187
return !has_error ();
1185
1188
}
@@ -1193,15 +1196,11 @@ constexpr void BasicFormatString<StringType, ParameterTypes...>::validate_type(
1193
1196
switch (type)
1194
1197
{
1195
1198
case ParameterType::Generic:
1196
- if (specifier.m_type != FormatSpecifier::Type::None)
1197
- {
1198
- on_error (" Generic types must be formatted with {}" );
1199
- }
1199
+ on_error (" Generic types must be formatted with {}" );
1200
1200
break ;
1201
1201
1202
1202
case ParameterType::Character:
1203
- if ((specifier.m_type != FormatSpecifier::Type::None) &&
1204
- (specifier.m_type != FormatSpecifier::Type::Character) &&
1203
+ if ((specifier.m_type != FormatSpecifier::Type::Character) &&
1205
1204
(specifier.m_type != FormatSpecifier::Type::Binary) &&
1206
1205
(specifier.m_type != FormatSpecifier::Type::Octal) &&
1207
1206
(specifier.m_type != FormatSpecifier::Type::Decimal) &&
@@ -1212,24 +1211,21 @@ constexpr void BasicFormatString<StringType, ParameterTypes...>::validate_type(
1212
1211
break ;
1213
1212
1214
1213
case ParameterType::String:
1215
- if ((specifier.m_type != FormatSpecifier::Type::None) &&
1216
- (specifier.m_type != FormatSpecifier::Type::String))
1214
+ if (specifier.m_type != FormatSpecifier::Type::String)
1217
1215
{
1218
1216
on_error (" String types must be formatted with {} or {:s}" );
1219
1217
}
1220
1218
break ;
1221
1219
1222
1220
case ParameterType::Pointer:
1223
- if ((specifier.m_type != FormatSpecifier::Type::None) &&
1224
- (specifier.m_type != FormatSpecifier::Type::Pointer))
1221
+ if (specifier.m_type != FormatSpecifier::Type::Pointer)
1225
1222
{
1226
1223
on_error (" Pointer types must be formatted with {} or {:p}" );
1227
1224
}
1228
1225
break ;
1229
1226
1230
1227
case ParameterType::Integral:
1231
- if ((specifier.m_type != FormatSpecifier::Type::None) &&
1232
- (specifier.m_type != FormatSpecifier::Type::Character) &&
1228
+ if ((specifier.m_type != FormatSpecifier::Type::Character) &&
1233
1229
(specifier.m_type != FormatSpecifier::Type::Binary) &&
1234
1230
(specifier.m_type != FormatSpecifier::Type::Octal) &&
1235
1231
(specifier.m_type != FormatSpecifier::Type::Decimal) &&
@@ -1240,8 +1236,7 @@ constexpr void BasicFormatString<StringType, ParameterTypes...>::validate_type(
1240
1236
break ;
1241
1237
1242
1238
case ParameterType::FloatingPoint:
1243
- if ((specifier.m_type != FormatSpecifier::Type::None) &&
1244
- (specifier.m_type != FormatSpecifier::Type::HexFloat) &&
1239
+ if ((specifier.m_type != FormatSpecifier::Type::HexFloat) &&
1245
1240
(specifier.m_type != FormatSpecifier::Type::Scientific) &&
1246
1241
(specifier.m_type != FormatSpecifier::Type::Fixed ) &&
1247
1242
(specifier.m_type != FormatSpecifier::Type::General))
@@ -1251,8 +1246,7 @@ constexpr void BasicFormatString<StringType, ParameterTypes...>::validate_type(
1251
1246
break ;
1252
1247
1253
1248
case ParameterType::Boolean :
1254
- if ((specifier.m_type != FormatSpecifier::Type::None) &&
1255
- (specifier.m_type != FormatSpecifier::Type::Character) &&
1249
+ if ((specifier.m_type != FormatSpecifier::Type::Character) &&
1256
1250
(specifier.m_type != FormatSpecifier::Type::String) &&
1257
1251
(specifier.m_type != FormatSpecifier::Type::Binary) &&
1258
1252
(specifier.m_type != FormatSpecifier::Type::Octal) &&
0 commit comments