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

Workaround GCC 12 warning #2498

Merged
merged 2 commits into from
Sep 30, 2022
Merged

Workaround GCC 12 warning #2498

merged 2 commits into from
Sep 30, 2022

Conversation

offa
Copy link
Contributor

@offa offa commented Sep 29, 2022

Building tests on GCC 12 fails due to a false positive in functional header:

In file included from /usr/local/include/c++/12.2.0/functional:59,
                 from […]/spdlog/tests/catch.hpp:3481,
                 from […]/spdlog/tests/includes.h:3,
                 from […]/spdlog/tests/test_daily_logger.cpp:4:
In constructor 'std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]',
    inlined from 'std::__detail::_State<_Char_type>::_State(std::__detail::_State<_Char_type>&&) [with _Char_type = char]' at /usr/local/include/c++/12.2.0/bits/regex_automaton.h:149:4,
    inlined from 'std::__detail::_State<_Char_type>::_State(std::__detail::_State<_Char_type>&&) [with _Char_type = char]' at /usr/local/include/c++/12.2.0/bits/regex_automaton.h:146:7,
    inlined from 'std::__detail::_StateIdT std::__detail::_NFA<_TraitsT>::_M_insert_subexpr_end() [with _TraitsT = std::__cxx11::regex_traits<char>]' at /usr/local/include/c++/12.2.0/bits/regex_automaton.h:290:24:
/usr/local/include/c++/12.2.0/bits/std_function.h:405:42: error: '*(std::function<bool(char)>*)((char*)&__tmp + offsetof(std::__detail::_StateT, std::__detail::_State<char>::<unnamed>.std::__detail::_State_base::<unnamed>)).std::function<bool(char)>::_M_invoker' may be used uninitialized [-Werror=maybe-uninitialized]
  405 |       : _Function_base(), _M_invoker(__x._M_invoker)
      |                                      ~~~~^~~~~~~~~~
compilation terminated due to -Wfatal-errors.

@gabime
Copy link
Owner

gabime commented Sep 29, 2022

Thanks. Perhaps its better to surround with pragma push/pop around the include to catch.hpp instead of disabling this warning globally.

@offa
Copy link
Contributor Author

offa commented Sep 30, 2022

Indeed, since there's a include.h it's a change at one place only. I'll give it a try 👍.

@offa
Copy link
Contributor Author

offa commented Sep 30, 2022

PR updated.

@gabime gabime merged commit 7fa59cf into gabime:v1.x Sep 30, 2022
@gabime
Copy link
Owner

gabime commented Sep 30, 2022

Thanks @offa

@offa offa deleted the gcc12_workaround branch October 1, 2022 16:07
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

Successfully merging this pull request may close these issues.

2 participants