From 6090e51b655142f71c5cab183c6d229f3c605737 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 28 Feb 2018 04:49:20 -0800 Subject: [PATCH] Fix compilation errors on gcc 4.6 --- include/fmt/format.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 211279bc..7eac976d 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2002,7 +2002,8 @@ class format_string_checker { public: explicit FMT_CONSTEXPR format_string_checker( basic_string_view format_str, ErrorHandler eh) - : arg_id_(-1), context_(format_str, eh) {} + : arg_id_(-1), context_(format_str, eh), + parse_funcs_{&parse_format_specs...} {} FMT_CONSTEXPR void on_text(const Char *, const Char *) {} @@ -2043,9 +2044,7 @@ class format_string_checker { int arg_id_; parse_context_type context_; - parse_func parse_funcs_[NUM_ARGS > 0 ? NUM_ARGS : 1] = { - &parse_format_specs... - }; + parse_func parse_funcs_[NUM_ARGS > 0 ? NUM_ARGS : 1]; }; template @@ -2286,7 +2285,7 @@ class basic_writer { const Spec &spec; unsigned_type abs_value; char prefix[4]; - unsigned prefix_size = 0; + unsigned prefix_size; string_view get_prefix() const { return string_view(prefix, prefix_size); } @@ -2302,7 +2301,8 @@ class basic_writer { } int_writer(basic_writer &w, Int value, const Spec &s) - : writer(w), spec(s), abs_value(static_cast(value)) { + : writer(w), spec(s), abs_value(static_cast(value)), + prefix_size(0) { if (internal::is_negative(value)) { prefix[0] = '-'; ++prefix_size; @@ -2609,9 +2609,9 @@ void basic_writer::write_double(T value, const format_specs &spec) { // Check type. struct spec_handler { char_type type; - bool upper = false; + bool upper; - explicit spec_handler(char_type t) : type(t) {} + explicit spec_handler(char_type t) : type(t), upper(false) {} void on_general() { if (type == 'G') @@ -2750,6 +2750,7 @@ class output_range { sentinel end() const; public: + typedef OutputIt iterator; typedef T value_type; explicit output_range(OutputIt it): it_(it) {} @@ -2764,8 +2765,8 @@ class back_insert_range: public: typedef typename Container::value_type value_type; - using base::base; back_insert_range(Container &c): base(std::back_inserter(c)) {} + back_insert_range(typename base::iterator it): base(it) {} }; typedef basic_writer> writer;