You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Integration with {fmt} has a problem if only <fmt/core.h> is included. Because it defines FMT_VERSION that triggers {fmt} integration, but does not provides fmt::to_string which is defined in <fmt/format.h>
<source>: In static member function 'static std::string ApprovalTests::FmtToString::toString(const T&)':
<source>:1028:25: error: 'to_string' is not a member of 'fmt'; did you mean 'std::__cxx11::to_string'?
1028 | return fmt::to_string(printable);
| ^~~~~~~~~
In file included from /opt/compiler-explorer/gcc-13.2.0/include/c++/13.2.0/string:54,
from /opt/compiler-explorer/gcc-13.2.0/include/c++/13.2.0/bits/locale_classes.h:40,
from /opt/compiler-explorer/gcc-13.2.0/include/c++/13.2.0/bits/ios_base.h:41,
from /opt/compiler-explorer/gcc-13.2.0/include/c++/13.2.0/streambuf:43,
from /opt/compiler-explorer/gcc-13.2.0/include/c++/13.2.0/bits/streambuf_iterator.h:35,
from /opt/compiler-explorer/gcc-13.2.0/include/c++/13.2.0/iterator:66,
from /opt/compiler-explorer/libs/fmt/10.1.1/include/fmt/core.h:14,
from <source>:1:
/opt/compiler-explorer/gcc-13.2.0/include/c++/13.2.0/bits/basic_string.h:4249:3: note: 'std::__cxx11::to_string' declared here
4249 | to_string(longdouble __val)
| ^~~~~~~~~
Compiler returned: 1
The text was updated successfully, but these errors were encountered:
Redo fmt detection to use FMT_FORMAT_H_ define guard (looks unstable)
Include <fmt/format.h> and fmt integration manually instead of autodetect. For e.g. #ifdef APPROVALS_USE_FMT. At least integration with other testing frameworks is done this way instead of using hacky detections
1st looks more stable for v10, while I would prefer 3rd option as a v11 solution. I personally bumped up in this bug, when I included header that includes <fmt/core.h> in the approvals based test code. It is not the best way to bump into library feature
YarikTH
added a commit
to YarikTH/ApprovalTests.cpp
that referenced
this issue
Sep 26, 2023
Integration with
{fmt}
has a problem if only <fmt/core.h> is included. Because it defines FMT_VERSION that triggers{fmt}
integration, but does not providesfmt::to_string
which is defined in<fmt/format.h>
https://godbolt.org/z/3WTE6f3b6
The text was updated successfully, but these errors were encountered: