Skip to content
This repository was archived by the owner on May 29, 2020. It is now read-only.

init-list-lifetime warnings in GCC #18

@MacDue

Description

@MacDue

I like the library but using it with GCC 9 results in a large amount of warnings about initializer_lists.

All the warnings are roughly the same as:

In file included from /home/macdue/git/bot/formatxx/include/formatxx/format.h:111,
                 from /home/macdue/git/bot/formatxx/include/formatxx/std_string.h:35,
                 from /home/macdue/git/bot/./src/include/dueutil/util.h:15,
                 from /home/macdue/git/bot/./src/include/dueutil/game/builtin_item_actions.h:7,
                 from /home/macdue/git/bot/src/dueutil/game/builtin_item_actions.cpp:1:
/home/macdue/git/bot/formatxx/include/formatxx/_detail/format_arg.h: In instantiation of ‘constexpr formatxx::_detail::basic_format_arg_list<CharT>::basic_format_arg_list(std::initializer_list<formatxx::_detail::basic_format_arg<CharT> >) [with CharT = char]’:
/home/macdue/git/bot/formatxx/include/formatxx/format.h:206:25:   required from ‘constexpr ResultT formatxx::format_as(const FormatT&, const Args& ...) [with ResultT = std::__cxx11::basic_string<char>; FormatT = char [21]; Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
/home/macdue/git/bot/formatxx/include/formatxx/std_string.h:51:34:   required from ‘StringT formatxx::format_string(const FormatT&, const Args& ...) [with StringT = std::__cxx11::basic_string<char>; FormatT = char [21]; Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
/home/macdue/git/bot/./src/include/dueutil/util.h:78:35:   required from ‘std::string DueUtil::Util::format(const FormatT&, const Args& ...) [with FormatT = char [21]; Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}; std::string = std::__cxx11::basic_string<char>]’
/home/macdue/git/bot/./src/include/dueutil/util.h:85:24:   required from ‘void DueUtil::Util::sayf(DueUtil::Util::ChannelInfo, const FormatT&, const Args& ...) [with FormatT = char [21]; Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}]’
/home/macdue/git/bot/./src/include/dueutil/util.h:89:51:   required from here
/home/macdue/git/bot/formatxx/include/formatxx/_detail/format_arg.h:92:132: warning: initializing ‘formatxx::_detail::basic_format_arg_list<char>::_args’ from ‘std::initializer_list<formatxx::_detail::basic_format_arg<char> >::begin’ does not extend the lifetime of the underlying array [-Winit-list-lifetime]
   92 |     constexpr basic_format_arg_list(std::initializer_list<format_arg_type> args) noexcept : _args(args.begin()), _count(args.size()) {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions