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

need operator-- for mozc::ZeroQueryDict::iterator #441

Closed
farseerfc opened this issue May 9, 2018 · 5 comments
Closed

need operator-- for mozc::ZeroQueryDict::iterator #441

farseerfc opened this issue May 9, 2018 · 5 comments

Comments

@farseerfc
Copy link

Otherwise on gcc 8.1 STL library will complain errors like:

In file included from ../../engine/engine.cc:30:
In file included from /build/fcitx5-mozc-git/src/mozc/src/engine/engine.h:33:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.1.0/../../../../include/c++/8.1.0/memory:62:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.1.0/../../../../include/c++/8.1.0/bits/stl_algobase.h:66:
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.1.0/../../../../include/c++/8.1.0/bits/stl_iterator_base_funcs.h:183:2: error: cannot decrement value of type 'mozc::ZeroQueryDict::iterator'
        --__i;
        ^ ~~~
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.1.0/../../../../include/c++/8.1.0/bits/stl_iterator_base_funcs.h:206:12: note: in instantiation of function template specialization 'std::__advance<mozc::ZeroQueryDict::iterator, long>' requested here
      std::__advance(__i, __d, std::__iterator_category(__i));
           ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.1.0/../../../../include/c++/8.1.0/bits/stl_algo.h:2137:9: note: in instantiation of function template specialization 'std::advance<mozc::ZeroQueryDict::iterator, long>' requested here
          std::advance(__middle, __half);
               ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.1.0/../../../../include/c++/8.1.0/bits/stl_algo.h:2190:19: note: in instantiation of function template specialization 'std::__equal_range<mozc::ZeroQueryDict::iterator, unsigned long, __gnu_cxx::__ops::_Iter_less_val, __gnu_cxx::__ops::_Val_less_iter>' requested here
      return std::__equal_range(__first, __last, __val,
                  ^
/build/fcitx5-mozc-git/src/mozc/src/prediction/zero_query_dict.h:213:17: note: in instantiation of function template specialization 'std::equal_range<mozc::ZeroQueryDict::iterator, unsigned long>' requested here
    return std::equal_range(begin(), end(), iter.index());
                ^
1 error generated.

A full error message is here: https://fars.ee/DAiY

I have written a patch to fix this: https://fars.ee/2is4

@musover
Copy link

musover commented May 11, 2018

I have been able to reproduce this issue.

[597/747] /usr/bin/x86_64-pc-linux-gnu-g++ -MMD -MF obj/engine/engine.engine.o.d -DOS_LINUX -DMOZC_BUILD -DCHANNEL_DEV -DNDEBUG -DQT_NO_DEBUG -DNO_LOGGING -DIGNORE_HELP_FLAG -DIGNORE_INVALID_FLAG -I/var/tmp/portage/app-i18n/mozc-9999/work/mozc-9999/src -Igen -Igen/proto_
out -Wall -Wno-char-subscripts -Wno-sign-compare -Wno-deprecated-declarations -Wwrite-strings -Wno-unknown-warning-option -Wno-inconsistent-missing-override -fPIC -fno-exceptions -fmessage-length=0 -fno-strict-aliasing -funsigned-char -pipe -pthread -fno-omit-frame-point
er -fstack-protector --param=ssp-buffer-size=4 -Wtype-limits -march=native -O2 -pipe -Wno-deprecated -Wno-covered-switch-default -Wno-unnamed-type-template-args -Wno-c++11-narrowing -std=gnu++0x -std=gnu++0x  -c ../../engine/engine.cc -o obj/engine/engine.engine.o
FAILED: obj/engine/engine.engine.o                                                      
/usr/bin/x86_64-pc-linux-gnu-g++ -MMD -MF obj/engine/engine.engine.o.d -DOS_LINUX -DMOZC_BUILD -DCHANNEL_DEV -DNDEBUG -DQT_NO_DEBUG -DNO_LOGGING -DIGNORE_HELP_FLAG -DIGNORE_INVALID_FLAG -I/var/tmp/portage/app-i18n/mozc-9999/work/mozc-9999/src -Igen -Igen/proto_out -Wall
-Wno-char-subscripts -Wno-sign-compare -Wno-deprecated-declarations -Wwrite-strings -Wno-unknown-warning-option -Wno-inconsistent-missing-override -fPIC -fno-exceptions -fmessage-length=0 -fno-strict-aliasing -funsigned-char -pipe -pthread -fno-omit-frame-pointer -fstack
-protector --param=ssp-buffer-size=4 -Wtype-limits -march=native -O2 -pipe -Wno-deprecated -Wno-covered-switch-default -Wno-unnamed-type-template-args -Wno-c++11-narrowing -std=gnu++0x -std=gnu++0x  -c ../../engine/engine.cc -o obj/engine/engine.engine.o
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/8.1.0/include/g++-v8/bits/stl_algobase.h:66,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/8.1.0/include/g++-v8/memory:62,
                 from /var/tmp/portage/app-i18n/mozc-9999/work/mozc-9999/src/engine/engine.h:33,
                 from ../../engine/engine.cc:30:
/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.0/include/g++-v8/bits/stl_iterator_base_funcs.h: In instantiation of ‘void std::__advance(_RandomAccessIterator&, _Distance, std::random_access_iterator_tag) [with _RandomAccessIterator = mozc::ZeroQueryDict::iterator; _Distance = lon
g int]’:
/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.0/include/g++-v8/bits/stl_iterator_base_funcs.h:206:21:   required from ‘void std::advance(_InputIterator&, _Distance) [with _InputIterator = mozc::ZeroQueryDict::iterator; _Distance = long int]’
/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.0/include/g++-v8/bits/stl_algo.h:2137:16:   required from ‘std::pair<_FIter, _FIter> std::__equal_range(_ForwardIterator, _ForwardIterator, const _Tp&, _CompareItTp, _CompareTpIt) [with _ForwardIterator = mozc::ZeroQueryDict::iterator
; _Tp = long unsigned int; _CompareItTp = __gnu_cxx::__ops::_Iter_less_val; _CompareTpIt = __gnu_cxx::__ops::_Val_less_iter]’
/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.0/include/g++-v8/bits/stl_algo.h:2190:32:   required from ‘std::pair<_FIter, _FIter> std::equal_range(_FIter, _FIter, const _Tp&) [with _FIter = mozc::ZeroQueryDict::iterator; _Tp = long unsigned int]’
/var/tmp/portage/app-i18n/mozc-9999/work/mozc-9999/src/prediction/zero_query_dict.h:213:57:   required from here
/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.0/include/g++-v8/bits/stl_iterator_base_funcs.h:183:2: error: no match for ‘operator--’ (operand type is ‘mozc::ZeroQueryDict::iterator’)
  --__i;                                       
  ^~~~~

@miangraham
Copy link

This breaks the mozc build for me on current arch linux (-S mozc uim-mozc). @farseerfc's patch confirmed working.

@Arfrever
Copy link

The relevant change in GCC libstdc++ which caused this problem for Mozc is:
https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=248875

@Arfrever
Copy link

I think that for consistency with other code the new functions should be added at line 150, not 135.

@hiroyuki-komatsu
Copy link
Collaborator

a1dcada fixed this issue.

Thank you for the report.

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

No branches or pull requests

5 participants