scsitape/stenc

Compilation error after merge PR91

sunwire opened this issue · 3 comments

OS: Fedora 36 x86_64
g++ --version
g++ (GCC) 12.1.1 20220507 (Red Hat 12.1.1-1)

$ LANG=C make
make all-recursive
make[1]: Entering directory '/home/pawel/stenc'
Making all in src
make[2]: Entering directory '/home/pawel/stenc/src'
depbase=echo main.o | sed 's|[^/]*$|.deps/&|;s|\.o$||';
g++ -DHAVE_CONFIG_H -I. -I.. -std=c++17 -g -O2 -MT main.o -MD -MP -MF $depbase.Tpo -c -o main.o main.cpp &&
mv -f $depbase.Tpo $depbase.Po
main.cpp: In function 'int main(int, char**)':
main.cpp:407:30: error: 'numeric_limits' is not a member of 'std'
407 | conv_result > std::numeric_limits<
| ^~~~~~~~~~~~~~
main.cpp:408:66: error: expected primary-expression before '>' token
408 | decltype(algorithm_index)::value_type>::max()) {
| ^
main.cpp:408:69: error: '::max' has not been declared; did you mean 'std::max'?
408 | decltype(algorithm_index)::value_type>::max()) {
| ^~~
| std::max
In file included from /usr/include/c++/12/algorithm:61,
from main.cpp:18:
/usr/include/c++/12/bits/stl_algo.h:5756:5: note: 'std::max' declared here
5756 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
make[2]: *** [Makefile:370: main.o] Error 1
make[2]: Leaving directory '/home/pawel/stenc/src'
make[1]: *** [Makefile:361: all-recursive] Error 1
make[1]: Leaving directory '/home/pawel/stenc'
make: *** [Makefile:302: all] Error 2

Update.
It seems that adding #include <limits> does the job.

Thanks. Why didn't we get a warning before? Did we miss a warning flag?

Why didn't we get a warning before? Did we miss a warning flag?

I think it is caused by GCC 12 in Fedora see Header dependency changes
Ubuntu 20.04 has gcc version 9.