cpptoml icon indicating copy to clipboard operation
cpptoml copied to clipboard

GCC 11.1.0 build errors

Open Valmar33 opened this issue 3 years ago • 6 comments

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

Valmar33 avatar May 17 '21 10:05 Valmar33

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

richmattes avatar May 25 '21 02:05 richmattes

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>

acarrillo avatar Jun 15 '22 03:06 acarrillo