@@ -495,7 +495,11 @@ namespace detail {
495
495
class FormatArg
496
496
{
497
497
public:
498
- FormatArg () {}
498
+ FormatArg ()
499
+ : m_value(nullptr ),
500
+ m_formatImpl (nullptr ),
501
+ m_toIntImpl(nullptr )
502
+ { }
499
503
500
504
template <typename T>
501
505
explicit FormatArg (const T& value)
@@ -507,11 +511,15 @@ class FormatArg
507
511
void format (std::ostream& out, const char * fmtBegin,
508
512
const char * fmtEnd, int ntrunc) const
509
513
{
514
+ assert (m_value);
515
+ assert (m_formatImpl);
510
516
m_formatImpl (out, fmtBegin, fmtEnd, ntrunc, m_value);
511
517
}
512
518
513
519
int toInt () const
514
520
{
521
+ assert (m_value);
522
+ assert (m_toIntImpl);
515
523
return m_toIntImpl (m_value);
516
524
}
517
525
@@ -712,23 +720,27 @@ inline const char* streamStateFromFormat(std::ostream& out, bool& spacePadPositi
712
720
break ;
713
721
case ' X' :
714
722
out.setf (std::ios::uppercase);
723
+ // Falls through
715
724
case ' x' : case ' p' :
716
725
out.setf (std::ios::hex, std::ios::basefield);
717
726
intConversion = true ;
718
727
break ;
719
728
case ' E' :
720
729
out.setf (std::ios::uppercase);
730
+ // Falls through
721
731
case ' e' :
722
732
out.setf (std::ios::scientific, std::ios::floatfield);
723
733
out.setf (std::ios::dec, std::ios::basefield);
724
734
break ;
725
735
case ' F' :
726
736
out.setf (std::ios::uppercase);
737
+ // Falls through
727
738
case ' f' :
728
739
out.setf (std::ios::fixed, std::ios::floatfield);
729
740
break ;
730
741
case ' G' :
731
742
out.setf (std::ios::uppercase);
743
+ // Falls through
732
744
case ' g' :
733
745
out.setf (std::ios::dec, std::ios::basefield);
734
746
// As in boost::format, let stream decide float format.
0 commit comments