cpptoml
cpptoml copied to clipboard
GCC 11.1.0 build errors
https://invent.kde.org/-/snippets/1655
Errors of interest are:
/tmp/makepkg/decaf-emu-git/src/decaf-emu/libraries/cpptoml/include/cpptoml.h:1033:52: error: ‘numeric_limits’ is not a member of ‘std’
1033 | if (static_cast<uint64_t>(v->get()) > std::numeric_limits<T>::max())
| ^~~~~~~~~~~~~~
/tmp/makepkg/decaf-emu-git/src/decaf-emu/libraries/cpptoml/include/cpptoml.h:1033:68: error: expected primary-expression before ‘>’ token
1033 | if (static_cast<uint64_t>(v->get()) > std::numeric_limits<T>::max())
| ^
/tmp/makepkg/decaf-emu-git/src/decaf-emu/libraries/cpptoml/include/cpptoml.h:1033:71: error: ‘::max’ has not been declared; did you mean ‘std::max’?
1033 | if (static_cast<uint64_t>(v->get()) > std::numeric_limits<T>::max())
| ^~~
| std::max
Seeing the same on Fedora 34 on the v0.1.1
tag and on master
. Reproduce with:
docker run --rm=true -it fedora:34 /bin/bash
# Inside docker image
dnf install -y gcc-c++ git cmake
git clone https://github.com/skystrife/cpptoml.git
cmake -B cpptoml-build -S cpptoml
cmake --build cpptoml-build
Adding #include <limits>
too include/cpptoml.h
fixes the issue, as addressed in #123
Can confirm, GCC 9.4.0 against C++17. In my codebase I just include <limits>
before including <cpptoml.h>
#include <limits>
#include <cpptoml.h>