diff --git a/include/fmt/core.h b/include/fmt/core.h index efd44385..fef420d2 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -346,7 +346,7 @@ class container_buffer : public basic_buffer { Container &container_; protected: - virtual void grow(std::size_t capacity) { + void grow(std::size_t capacity) FMT_OVERRIDE { container_.resize(capacity); this->set(&container_[0], capacity); } @@ -801,10 +801,10 @@ class context_base { // Extracts a reference to the container from back_insert_iterator. template inline Container &get_container(std::back_insert_iterator it) { - typedef std::back_insert_iterator iterator; - struct accessor: iterator { - accessor(iterator it) : iterator(it) {} - using iterator::container; + typedef std::back_insert_iterator bi_iterator; + struct accessor: bi_iterator { + accessor(bi_iterator it) : bi_iterator(it) {} + using bi_iterator::container; }; return *accessor(it).container; } @@ -865,11 +865,8 @@ typedef buffer_context::type wcontext; namespace internal { template class get_type { - private: - static const T& val(); - public: - typedef decltype(make_value(val())) value_type; + typedef decltype(make_value(std::declval::type&>())) value_type; static const type value = value_type::type_tag; }; diff --git a/include/fmt/format.h b/include/fmt/format.h index ccd12f03..e1c3e155 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -382,7 +382,7 @@ class basic_memory_buffer: private Allocator, public internal::basic_buffer { } protected: - void grow(std::size_t size); + void grow(std::size_t size) FMT_OVERRIDE; public: explicit basic_memory_buffer(const Allocator &alloc = Allocator()) @@ -494,7 +494,7 @@ class basic_fixed_buffer : public internal::basic_buffer { } protected: - FMT_API void grow(std::size_t size); + FMT_API void grow(std::size_t size) FMT_OVERRIDE; }; namespace internal { @@ -567,7 +567,7 @@ template class null_terminating_iterator; template -FMT_CONSTEXPR const Char *pointer_from(null_terminating_iterator it); +FMT_CONSTEXPR_DECL const Char *pointer_from(null_terminating_iterator it); // An iterator that produces a null terminator on *end. This simplifies parsing // and allows comparing the performance of processing a null-terminated string @@ -642,7 +642,13 @@ class null_terminating_iterator { return ptr_ >= other.ptr_; } + // 'fmt::internal::pointer_from': the inline specifier cannot be used + // when a friend declaration refers to a specialization of a function + + // pointer_from is defined with the inline specifier, but declared without, + // so this looks like a bug in the compiler. friend FMT_CONSTEXPR_DECL const Char *pointer_from( +# pragma warning(suppress: 4396) null_terminating_iterator it); private: @@ -1360,7 +1366,7 @@ class arg_formatter_base { } void write(const char_type *value) { - auto length = value != 0 ? std::char_traits::length(value) : 0; + auto length = value != FMT_NULL ? std::char_traits::length(value) : 0; writer_.write_str(basic_string_view(value, length), specs_); } @@ -2220,7 +2226,7 @@ class basic_writer { struct padded_int_writer { string_view prefix; wchar_t fill; - unsigned padding; + std::size_t padding; F f; template @@ -2238,9 +2244,9 @@ class basic_writer { template void write_int(unsigned num_digits, string_view prefix, const Spec &spec, F f) { - unsigned size = prefix.size() + num_digits; + std::size_t size = prefix.size() + num_digits; auto fill = spec.fill(); - unsigned padding = 0; + std::size_t padding = 0; if (spec.align() == ALIGN_NUMERIC) { if (spec.width() > size) { padding = spec.width() - size;