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

Commit e009c3d fails to build with "error: wrong number of template arguments (0, should be 1)" #3934

Closed
asasine opened this issue Jul 7, 2022 · 5 comments
Labels

Comments

@asasine
Copy link

asasine commented Jul 7, 2022

Describe the bug

Building a test executable that links to the latest commit e009c3d fails with the following error:

[3/17] Building CXX object test/CMakeFiles/foo_test.dir/main.cpp.o�[K
FAILED: test/CMakeFiles/foo_test.dir/main.cpp.o 
/usr/bin/c++ -DROSCONSOLE_BACKEND_LOG4CXX -DROS_BUILD_SHARED_LIBS=1 -DROS_PACKAGE_NAME=\"foo\" -I/home/adam/src/foo/include -I/opt/ros/melodic/include -I/opt/ros/melodic/share/xmlrpcpp/cmake/../../../include/xmlrpcpp -I/usr/include/opencv -I/home/adam/src/foo/test/include -I/home/adam/src/foo/test/test -O2 -g -DNDEBUG -std=gnu++11 -MD -MT test/CMakeFiles/foo_test.dir/main.cpp.o -MF test/CMakeFiles/foo_test.dir/main.cpp.o.d -o test/CMakeFiles/foo_test.dir/main.cpp.o -c /home/adam/src/foo/test/main.cpp
In file included from /usr/local/include/gtest/gtest-printers.h:114:0,
                 from /usr/local/include/gtest/gtest-matchers.h:48,
                 from /usr/local/include/gtest/internal/gtest-death-test-internal.h:46,
                 from /usr/local/include/gtest/gtest-death-test.h:43,
                 from /usr/local/include/gtest/gtest.h:60,
                 from /home/adam/src/foo/test/main.cpp:1:
/usr/local/include/gtest/internal/gtest-internal.h:635:58: error: wrong number of template arguments (0, should be 1)
   typedef ::std::map<std::string, CodeLocation, std::less<>> RegisteredTestsMap;
                                                          ^
In file included from /usr/include/c++/7/memory:76:0,
                 from /usr/local/include/gtest/gtest.h:54,
                 from /home/adam/src/foo/test/main.cpp:1:
/usr/include/c++/7/bits/stl_function.h:381:12: note: provided for ‘template<class _Tp> struct std::less’
     struct less : public binary_function<_Tp, _Tp, bool>
            ^~~~

This appears as a failure to CI too https://github.com/google/googletest/actions/runs/2630923698

Does the bug persist in the most recent commit?

Yes (commit e009c3d)

What operating system and version are you using?

Ubuntu 18.04

What compiler and version are you using?

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)

What build system are you using?

$ cmake --version
cmake version 3.23.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).
@asasine asasine added the bug label Jul 7, 2022
@TheMostDiligent
Copy link

We see the same build breakage on Mac with clang.

@derekmauro
Copy link
Member

The code is legal in C++14 but not C++11. We just raised our C++ minimum version to C++14, but we didn't update our CMake config to use cxx_std_14. A fix is coming. If you need a workaround, you can pass -DCMAKE_CXX_STANDARD=14 to CMake.

derekmauro referenced this issue Jul 8, 2022
PiperOrigin-RevId: 459529190
Change-Id: I6b29693000023b3562990742f27a98cc279b6452
@doraemon-hub-art
Copy link

The code is legal in C++14 but not C++11. We just raised our C++ minimum version to C++14, but we didn't update our CMake config to use cxx_std_14. A fix is coming. If you need a workaround, you can pass -DCMAKE_CXX_STANDARD=14 to CMake.

thanks you, i meet this mistake,this resolve my problem.

@Lianlii
Copy link

Lianlii commented Jul 20, 2022

这都忘改了。。。

@SC-One
Copy link

SC-One commented Sep 9, 2022

The code is legal in C++14 but not C++11. We just raised our C++ minimum version to C++14, but we didn't update our CMake config to use cxx_std_14. A fix is coming. If you need a workaround, you can pass -DCMAKE_CXX_STANDARD=14 to CMake.

Thanks , it works like a charm. :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants