Fails to compile with GCC 11.1.0 unless `-DCMAKE_CXX_STANDARD=20` is used
alex-tee opened this issue · comments
次のファイルから読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.cc:15:
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h: 関数 ‘typename std::vector<T>::iterator benchmark::internal::AddPowers(std::vector<T>*, T, T, int)’ 内:
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:22:30: エラー: ‘numeric_limits’ is not a member of ‘std’
22 | static const T kmax = std::numeric_limits<T>::max();
| ^~~~~~~~~~~~~~
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:22:46: エラー: expected primary-expression before ‘>’ token
22 | static const T kmax = std::numeric_limits<T>::max();
| ^
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:22:49: エラー: ‘::max’ has not been declared; did you mean ‘std::max’?
22 | static const T kmax = std::numeric_limits<T>::max();
| ^~~
| std::max
次のファイルから読み込み: /usr/include/c++/11.1.0/algorithm:62,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/include/benchmark/benchmark.h:172,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/internal_macros.h:4,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/check.h:8,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:6,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.cc:15:
/usr/include/c++/11.1.0/bits/stl_algo.h:3467:5: 備考: ‘std::max’ declared here
3467 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
次のファイルから読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:6,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.cc:15:
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h: 関数 ‘void benchmark::internal::AddNegatedPowers(std::vector<T>*, T, T, int)’ 内:
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:40:21: エラー: ‘numeric_limits’ is not a member of ‘std’
40 | CHECK_GT(lo, std::numeric_limits<T>::min());
| ^~~~~~~~~~~~~~
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/check.h:58:4: 備考: in definition of macro ‘CHECK’
58 | (b ? ::benchmark::internal::GetNullLogInstance() \
| ^
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:40:3: 備考: in expansion of macro ‘CHECK_GT’
40 | CHECK_GT(lo, std::numeric_limits<T>::min());
| ^~~~~~~~
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:40:37: エラー: expected primary-expression before ‘>’ token
40 | CHECK_GT(lo, std::numeric_limits<T>::min());
| ^
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/check.h:58:4: 備考: in definition of macro ‘CHECK’
58 | (b ? ::benchmark::internal::GetNullLogInstance() \
| ^
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:40:3: 備考: in expansion of macro ‘CHECK_GT’
40 | CHECK_GT(lo, std::numeric_limits<T>::min());
| ^~~~~~~~
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:40:40: エラー: ‘::min’ has not been declared; did you mean ‘std::min’?
40 | CHECK_GT(lo, std::numeric_limits<T>::min());
| ^~~
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/check.h:58:4: 備考: in definition of macro ‘CHECK’
58 | (b ? ::benchmark::internal::GetNullLogInstance() \
| ^
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:40:3: 備考: in expansion of macro ‘CHECK_GT’
40 | CHECK_GT(lo, std::numeric_limits<T>::min());
| ^~~~~~~~
次のファイルから読み込み: /usr/include/c++/11.1.0/algorithm:62,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/include/benchmark/benchmark.h:172,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/internal_macros.h:4,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/check.h:8,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:6,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.cc:15:
/usr/include/c++/11.1.0/bits/stl_algo.h:3455:5: 備考: ‘std::min’ declared here
3455 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
次のファイルから読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:6,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.cc:15:
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:41:21: エラー: ‘numeric_limits’ is not a member of ‘std’
41 | CHECK_GT(hi, std::numeric_limits<T>::min());
| ^~~~~~~~~~~~~~
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/check.h:58:4: 備考: in definition of macro ‘CHECK’
58 | (b ? ::benchmark::internal::GetNullLogInstance() \
| ^
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:41:3: 備考: in expansion of macro ‘CHECK_GT’
41 | CHECK_GT(hi, std::numeric_limits<T>::min());
| ^~~~~~~~
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:41:37: エラー: expected primary-expression before ‘>’ token
41 | CHECK_GT(hi, std::numeric_limits<T>::min());
| ^
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/check.h:58:4: 備考: in definition of macro ‘CHECK’
58 | (b ? ::benchmark::internal::GetNullLogInstance() \
| ^
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:41:3: 備考: in expansion of macro ‘CHECK_GT’
41 | CHECK_GT(hi, std::numeric_limits<T>::min());
| ^~~~~~~~
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:41:40: エラー: ‘::min’ has not been declared; did you mean ‘std::min’?
41 | CHECK_GT(hi, std::numeric_limits<T>::min());
| ^~~
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/check.h:58:4: 備考: in definition of macro ‘CHECK’
58 | (b ? ::benchmark::internal::GetNullLogInstance() \
| ^
/home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:41:3: 備考: in expansion of macro ‘CHECK_GT’
41 | CHECK_GT(hi, std::numeric_limits<T>::min());
| ^~~~~~~~
次のファイルから読み込み: /usr/include/c++/11.1.0/algorithm:62,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/include/benchmark/benchmark.h:172,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/internal_macros.h:4,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/check.h:8,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.h:6,
次から読み込み: /home/alex/Documents/aur/os-251/src/os-251/build/_deps/googlebenchmark-src/src/benchmark_register.cc:15:
/usr/include/c++/11.1.0/bits/stl_algo.h:3455:5: 備考: ‘std::min’ declared here
3455 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
make[2]: *** [_deps/googlebenchmark-build/src/CMakeFiles/benchmark.dir/build.make:118: _deps/googlebenchmark-build/src/CMakeFiles/benchmark.dir/benchmark_register.cc.o] エラー 1
make[2]: *** 未完了のジョブを待っています....
maybe this is related: http://gcc.gnu.org/gcc-11/porting_to.html
Header dependency changes
Some C++ Standard Library headers have been changed to no longer include other headers that they do need to depend on. As such, C++ programs that used standard library components without including the right headers will no longer compile.
The following headers are used less widely in libstdc++ and may need to be included explicitly when compiled with GCC 11:
(for std::numeric_limits)
(for std::unique_ptr, std::shared_ptr etc.)
(for std::pair, std::tuple_size, std::index_sequence etc.)
(for members of namespace std::this_thread.)
Thanks for reporting.
It will definitely help me when I upgrade GCC version.
If you want to build OS-251 without -DCMAKE_CXX_STANDARD=20
, please consider to use GCC 9.3.0 because CI use the version.