Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.0.0 is broken user code and some other issues with master #754

Closed
egorpugin opened this issue May 30, 2018 · 1 comment
Closed

5.0.0 is broken user code and some other issues with master #754

egorpugin opened this issue May 30, 2018 · 1 comment

Comments

@egorpugin
Copy link
Contributor

egorpugin commented May 30, 2018

Works with 4.1.0, does not work with 5.0.0 and master. VS2017 latest.

#include <fmt/format.h>
#include <string>
int main()
{
    std::string str{"{ML}"};
    auto s2 = fmt::format(str,
        fmt::arg("M", 1),
        fmt::arg("m", 1),
        fmt::arg("p", 1),
        fmt::arg("t", 1),
        fmt::arg("5", 1),
        // letter variants
        // captical
        fmt::arg("ML", 1),
        fmt::arg("mL", 1),
        fmt::arg("pL", 1),
        fmt::arg("tL", 1),
        fmt::arg("5L", 1),
        // small
        fmt::arg("Ml", 1),
        fmt::arg("ml", 1),
        fmt::arg("pl", 1),
        fmt::arg("tl", 1),
        fmt::arg("5l", 1),
        //
        fmt::arg("e", 1),
        fmt::arg("b", 1),
        fmt::arg("v", 1)
    );

Also I'd like to ask if it's possible to create formatters using loops. Maybe this is a planned feature? Or a feature that won't be implemented?

fmt::fmt_args args;
for (int i = 0; i < 10; i++)
    args[std::to_string(i)] = i;
fmt::format(str, args);

Second issue - errors in dll build on master

5>version.obj : error LNK2019: unresolved external symbol "class fmt::v5::internal::fp __cdecl fmt::v5::internal::operator*(class fmt::v5::internal::fp,class fmt::v5::internal::fp)" (??Dinternal@v5@fmt@@YA?AVfp@012@V3012@0@Z) referenced in function "private: void __cdecl fmt::v5::basic_writer<class fmt::v5::back_insert_range<class fmt::v5::internal::basic_buffer<char> > >::write_double<double>(double,class fmt::v5::basic_format_specs<char> const &)" (??$write_double@N@?$basic_writer@V?$back_insert_range@V?$basic_buffer@D@internal@v5@fmt@@@v5@fmt@@@v5@fmt@@AEAAXNAEBV?$basic_format_specs@D@12@@Z)
5>version.obj : error LNK2019: unresolved external symbol "class fmt::v5::internal::fp __cdecl fmt::v5::internal::get_cached_power(int,int &)" (?get_cached_power@internal@v5@fmt@@YA?AVfp@123@HAEAH@Z) referenced in function "private: void __cdecl fmt::v5::basic_writer<class fmt::v5::back_insert_range<class fmt::v5::internal::basic_buffer<char> > >::write_double<double>(double,class fmt::v5::basic_format_specs<char> const &)" (??$write_double@N@?$basic_writer@V?$back_insert_range@V?$basic_buffer@D@internal@v5@fmt@@@v5@fmt@@@v5@fmt@@AEAAXNAEBV?$basic_format_specs@D@12@@Z)

Third issue - warnings in 64 bit build, master

5>d:\dev\cppan_storage\src\ad\3c\20c0\include\fmt\format.h(2895): warning C4244: 'initializing': conversion from 'fmt::v5::internal::fp::significand_type' to 'uint32_t', possible loss of data
5>d:\dev\cppan_storage\src\ad\3c\20c0\include\fmt\format.h(1571): note: see reference to function template instantiation 'void fmt::v5::basic_writer<fmt::v5::back_insert_range<fmt::v5::internal::wbuffer>>::write_double<T>(T,const fmt::v5::basic_format_specs<wchar_t> &)' being compiled
5>        with
5>        [
5>            T=double
5>        ]
5>d:\dev\cppan_storage\src\ad\3c\20c0\include\fmt\format.h(1571): note: see reference to function template instantiation 'void fmt::v5::basic_writer<fmt::v5::back_insert_range<fmt::v5::internal::wbuffer>>::write_double<T>(T,const fmt::v5::basic_format_specs<wchar_t> &)' being compiled
5>        with
5>        [
5>            T=double
5>        ]
5>d:\dev\cppan_storage\src\ad\3c\20c0\include\fmt\format.h(1202): note: see reference to function template instantiation 'std::back_insert_iterator<fmt::v5::internal::basic_buffer<wchar_t>> fmt::v5::internal::arg_formatter_base<Range>::operator ()<double>(T)' being compiled
5>        with
5>        [
5>            Range=range,
5>            T=double
5>        ]
5>d:\dev\cppan_storage\src\ad\3c\20c0\include\fmt\format.h(1202): note: see reference to function template instantiation 'std::back_insert_iterator<fmt::v5::internal::basic_buffer<wchar_t>> fmt::v5::internal::arg_formatter_base<Range>::operator ()<double>(T)' being compiled
5>        with
5>        [
5>            Range=range,
5>            T=double
5>        ]
5>d:\dev\cppan_storage\src\ad\3c\20c0\include\fmt\format.h(3353): note: see reference to function template instantiation 'std::back_insert_iterator<fmt::v5::internal::basic_buffer<wchar_t>> fmt::v5::visit<ArgFormatter,Context>(Visitor &&,fmt::v5::basic_format_arg<Context>)' being compiled
5>        with
5>        [
5>            ArgFormatter=fmt::v5::arg_formatter<range>,
5>            Context=fmt::v5::wformat_context,
5>            Visitor=fmt::v5::arg_formatter<range>
5>        ]
5>d:\dev\cppan_storage\src\ad\3c\20c0\include\fmt\format.h(3340): note: while compiling class template member function 'fmt::v5::internal::null_terminating_iterator<Char> fmt::v5::format_handler<ArgFormatter,Char,Context>::on_format_specs(fmt::v5::internal::null_terminating_iterator<Char>)'
5>        with
5>        [
5>            Char=wchar_t,
5>            ArgFormatter=fmt::v5::arg_formatter<range>,
5>            Context=fmt::v5::wformat_context
5>        ]
5>d:\dev\cppan_storage\src\ad\3c\20c0\include\fmt\format.h(2177): note: see reference to function template instantiation 'fmt::v5::internal::null_terminating_iterator<Char> fmt::v5::format_handler<ArgFormatter,Char,Context>::on_format_specs(fmt::v5::internal::null_terminating_iterator<Char>)' being compiled
5>        with
5>        [
5>            Char=wchar_t,
5>            ArgFormatter=fmt::v5::arg_formatter<range>,
5>            Context=fmt::v5::wformat_context
5>        ]
5>d:\dev\cppan_storage\src\ad\3c\20c0\include\fmt\format.h(3367): note: see reference to class template instantiation 'fmt::v5::format_handler<ArgFormatter,Char,Context>' being compiled
5>        with
5>        [
5>            ArgFormatter=fmt::v5::arg_formatter<range>,
5>            Char=wchar_t,
5>            Context=fmt::v5::wformat_context
5>        ]
5>d:\dev\cppan_storage\src\ad\3c\20c0\include\fmt\format.h(3478): note: see reference to function template instantiation 'OutputIt fmt::v5::vformat_to<fmt::v5::arg_formatter<range>,wchar_t,fmt::v5::wformat_context>(fmt::v5::back_insert_range<fmt::v5::internal::wbuffer>,fmt::v5::basic_string_view<wchar_t>,fmt::v5::basic_format_args<fmt::v5::wformat_context>)' being compiled
5>        with
5>        [
5>            OutputIt=std::back_insert_iterator<fmt::v5::internal::basic_buffer<wchar_t>>
5>        ]
5>d:\dev\cppan_storage\src\ad\3c\20c0\include\fmt\format.h(2900): warning C4267: 'initializing': conversion from 'size_t' to 'unsigned int', possible loss of data
5>d:\dev\cppan_storage\src\ad\3c\20c0\include\fmt\format.h(2915): warning C4267: 'initializing': conversion from 'size_t' to 'unsigned int', possible loss of data
5>d:\dev\cppan_storage\src\ad\3c\20c0\include\fmt\format.h(305): warning C4244: '=': conversion from 'uint64_t' to 'int', possible loss of data
5>d:\dev\cppan_storage\src\ad\3c\20c0\include\fmt\format.h(2885): note: see reference to function template instantiation 'fmt::v5::internal::fp::fp<double>(Double)' being compiled
5>        with
5>        [
5>            Double=double
5>        ]
5>d:\dev\cppan_storage\src\ad\3c\20c0\include\fmt\format.h(1571): note: see reference to function template instantiation 'void fmt::v5::basic_writer<fmt::v5::back_insert_range<fmt::v5::internal::wbuffer>>::write_double<T>(T,const fmt::v5::basic_format_specs<wchar_t> &)' being compiled
5>        with
5>        [
5>            T=double
5>        ]
5>d:\dev\cppan_storage\src\ad\3c\20c0\include\fmt\format.h(1571): note: see reference to function template instantiation 'void fmt::v5::basic_writer<fmt::v5::back_insert_range<fmt::v5::internal::wbuffer>>::write_double<T>(T,const fmt::v5::basic_format_specs<wchar_t> &)' being compiled
5>        with
5>        [
5>            T=double
5>        ]
@vitaut
Copy link
Contributor

vitaut commented Jun 5, 2018

Fixed in d5c4625, thanks for reporting!

@vitaut vitaut closed this as completed Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants