Andersbakken / rtags

A client/server indexer for c/c++/objc[++] with integration for Emacs based on clang.
http://www.rtags.net
GNU General Public License v3.0
1.83k stars 253 forks source link

Breaking change in gcc-11 and clang-12 #1421

Open ramblehead opened 3 years ago

ramblehead commented 3 years ago

See https://stackoverflow.com/a/68149587

make error output example after successful cmake:

... [cut] ...
[ 27%] Building CXX object src/CMakeFiles/rct.dir/rct/rct/FileSystemWatcher.cpp.o
In file included from /home/rh/box/shed/rhpm/packages/emacs-rtags/src/src/rct/rct/Buffer.cpp:1:
In file included from /home/rh/box/shed/rhpm/packages/emacs-rtags/src/src/rct/rct/Buffer.h:7:
In file included from /home/rh/box/shed/rhpm/packages/emacs-rtags/src/src/rct/rct/String.h:9:
/home/rh/box/shed/rhpm/packages/emacs-rtags/src/src/rct/rct/List.h:17:41: error: no member named 'numeric_limits' in namespace 'std'
    static constexpr size_t npos = std::numeric_limits<size_t>::max();
                                   ~~~~~^
/home/rh/box/shed/rhpm/packages/emacs-rtags/src/src/rct/rct/List.h:17:56: error: unexpected type name 'size_t': expected expression
    static constexpr size_t npos = std::numeric_limits<size_t>::max();
                                                       ^
/home/rh/box/shed/rhpm/packages/emacs-rtags/src/src/rct/rct/List.h:17:65: error: no member named 'max' in the global namespace
    static constexpr size_t npos = std::numeric_limits<size_t>::max();
                                                              ~~^
3 errors generated.
make[2]: *** [src/CMakeFiles/rct.dir/build.make:89: src/CMakeFiles/rct.dir/rct/rct/Buffer.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
... [cut] ...

Temporary fix:

readonly GCC_VERSION=11
export readonly CXX=g++-${GCC_VERSION}
export readonly CXXFLAGS="-include /usr/include/c++/${GCC_VERSION}/limits"

In long term should be fixed in source.

seelabs commented 3 years ago

I just ran into this as well. I patched List.h to add #include <limits> to work around this.