Skip to content

error: cannot bind non-const lvalue reference of type ‘AFP&’ to an rvalue of type ‘AFP’ #2

@lucajovine

Description

@lucajovine

Hello, when installing FATCAT under Ubuntu 20.94, I get the following:

g++ -O2 -Wall -I./ -c FATCAT.C
g++ -O2 -Wall -I./ -c SAlnOpt.C
g++ -O2 -Wall -I./ -c SigEva.C
SigEva.C: In member function ‘double SIGEVA::calSig(int, int, int, double*)’:
SigEva.C:256:9: warning: variable ‘prob0’ set but not used [-Wunused-but-set-variable]
  double prob0;
         ^~~~~
g++ -O2 -Wall -I./ -c Prot.C
g++ -O2 -Wall -I./ -c AFPchain.C
AFPchain.C:872:1: warning: multi-line comment [-Wcomment]
 //       j1 -|---------------------\
 ^
AFPchain.C: In member function ‘void AFPCHAIN::MergeAfp(int, int*, int*)’:
AFPchain.C:445:35: warning: variable ‘j2’ set but not used [-Wunused-but-set-variable]
  int i, j, k, f1, f2, i1, i2, j1, j2, frag;
                                   ^~
AFPchain.C: In member function ‘void AFPCHAIN::UpdateScore()’:
AFPchain.C:1154:9: warning: variable ‘t’ set but not used [-Wunused-but-set-variable]
  double t, conn, dvar;
         ^
AFPchain.C: In member function ‘void AFPCHAIN::ShowAfpChainText()’:
AFPchain.C:1327:28: warning: variable ‘t’ set but not used [-Wunused-but-set-variable]
  int i, k, a, len, pi, pj, t, mis, gap, prev;
                            ^
AFPchain.C: In member function ‘void AFPCHAIN::ShowAfpChainPs()’:
AFPchain.C:1437:68: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
  PsShow *psShow = new PsShow(outfile, "alignment graph from FATCAT"); //refer PsShow.C and PsShow.h
                                                                    ^
AFPchain.C: In member function ‘void AFPCHAIN::ShowAfp(int)’:
AFPchain.C:1463:123: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
  PsShow *psShow = new PsShow(outfile, "%!PS-Adobe-3.0 EPSF-3.0\n%%BoundingBox: 0 0 500 500", "alignment graph from FATCAT"); //refer PsShow.C and PsShow.h
                                                                                                                           ^
AFPchain.C:1463:123: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
AFPchain.C:1559:76: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
  psShow->prtArrow(arrowpoint, blockNum - 1, ifcodtransform, "downleftarrow");
                                                                            ^
AFPchain.C: In member function ‘void AFPCHAIN::TransPdb(int, int*, int*)’:
AFPchain.C:1727:21: warning: variable ‘rmsd’ set but not used [-Wunused-but-set-variable]
  double r[9], t[3], rmsd;
                     ^~~~
In file included from /usr/include/c++/7/vector:69:0,
                 from basic.h:8,
                 from AFP.h:13,
                 from AFPchain.h:13,
                 from AFPchain.C:12:
/usr/include/c++/7/bits/vector.tcc: In instantiation of ‘void std::vector<_Tp, _Alloc>::_M_insert_aux(std::vector<_Tp, _Alloc>::iterator, _Arg&&) [with _Arg = AFP; _Tp = AFP; _Alloc = std::allocator<AFP>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<AFP*, std::vector<AFP> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = AFP*]’:
/usr/include/c++/7/bits/vector.tcc:136:19:   required from ‘std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, const value_type&) [with _Tp = AFP; _Alloc = std::allocator<AFP>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<AFP*, std::vector<AFP> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = AFP*; std::vector<_Tp, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator<const AFP*, std::vector<AFP> >; typename __gnu_cxx::__alloc_traits<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_pointer = const AFP*; std::vector<_Tp, _Alloc>::value_type = AFP]’
AFPchain.C:315:39:   required from here
/usr/include/c++/7/bits/vector.tcc:386:19: error: cannot bind non-const lvalue reference of type ‘AFP&’ to an rvalue of type ‘AFP’
       *__position = std::forward<_Arg>(__arg);
       ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from AFPchain.h:13:0,
                 from AFPchain.C:12:
AFP.h:103:8: note:   initializing argument 1 of ‘void AFP::operator=(AFP&)’
   void operator = (AFP &afp)
        ^~~~~~~~
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from basic.h:3,
                 from AFP.h:13,
                 from AFPchain.h:13,
                 from AFPchain.C:12:
/usr/include/c++/7/bits/stl_algobase.h: In instantiation of ‘static _BI2 std::__copy_move_backward<true, false, std::random_access_iterator_tag>::__copy_move_b(_BI1, _BI1, _BI2) [with _BI1 = AFP*; _BI2 = AFP*]’:
/usr/include/c++/7/bits/stl_algobase.h:588:58:   required from ‘_BI2 std::__copy_move_backward_a(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = AFP*; _BI2 = AFP*]’
/usr/include/c++/7/bits/stl_algobase.h:598:5:   required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = AFP*; _BI2 = AFP*]’
/usr/include/c++/7/bits/stl_algobase.h:668:48:   required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = AFP*; _BI2 = AFP*]’
/usr/include/c++/7/bits/vector.tcc:380:7:   required from ‘void std::vector<_Tp, _Alloc>::_M_insert_aux(std::vector<_Tp, _Alloc>::iterator, _Arg&&) [with _Arg = AFP; _Tp = AFP; _Alloc = std::allocator<AFP>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<AFP*, std::vector<AFP> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = AFP*]’
/usr/include/c++/7/bits/vector.tcc:136:19:   required from ‘std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, const value_type&) [with _Tp = AFP; _Alloc = std::allocator<AFP>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<AFP*, std::vector<AFP> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = AFP*; std::vector<_Tp, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator<const AFP*, std::vector<AFP> >; typename __gnu_cxx::__alloc_traits<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_pointer = const AFP*; std::vector<_Tp, _Alloc>::value_type = AFP]’
AFPchain.C:315:39:   required from here
/usr/include/c++/7/bits/stl_algobase.h:548:18: error: cannot bind non-const lvalue reference of type ‘AFP&’ to an rvalue of type ‘std::remove_reference<AFP&>::type {aka AFP}’
      *--__result = std::move(*--__last);
      ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from AFPchain.h:13:0,
                 from AFPchain.C:12:
AFP.h:103:8: note:   initializing argument 1 of ‘void AFP::operator=(AFP&)’
   void operator = (AFP &afp)
        ^~~~~~~~
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from basic.h:3,
                 from AFP.h:13,
                 from AFPchain.h:13,
                 from AFPchain.C:12:
/usr/include/c++/7/bits/stl_algobase.h: In instantiation of ‘static _OI std::__copy_move<true, false, std::random_access_iterator_tag>::__copy_m(_II, _II, _OI) [with _II = AFP*; _OI = AFP*]’:
/usr/include/c++/7/bits/stl_algobase.h:386:44:   required from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = true; _II = AFP*; _OI = AFP*]’
/usr/include/c++/7/bits/stl_algobase.h:422:45:   required from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator<AFP*, std::vector<AFP> >; _OI = __gnu_cxx::__normal_iterator<AFP*, std::vector<AFP> >]’
/usr/include/c++/7/bits/stl_algobase.h:487:39:   required from ‘_OI std::move(_II, _II, _OI) [with _II = __gnu_cxx::__normal_iterator<AFP*, std::vector<AFP> >; _OI = __gnu_cxx::__normal_iterator<AFP*, std::vector<AFP> >]’
/usr/include/c++/7/bits/vector.tcc:171:6:   required from ‘std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::_M_erase(std::vector<_Tp, _Alloc>::iterator, std::vector<_Tp, _Alloc>::iterator) [with _Tp = AFP; _Alloc = std::allocator<AFP>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<AFP*, std::vector<AFP> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = AFP*]’
/usr/include/c++/7/bits/stl_vector.h:1210:17:   required from ‘std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(std::vector<_Tp, _Alloc>::const_iterator, std::vector<_Tp, _Alloc>::const_iterator) [with _Tp = AFP; _Alloc = std::allocator<AFP>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<AFP*, std::vector<AFP> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = AFP*; std::vector<_Tp, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator<const AFP*, std::vector<AFP> >; typename __gnu_cxx::__alloc_traits<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_pointer = const AFP*]’
AFPchain.C:425:43:   required from here
/usr/include/c++/7/bits/stl_algobase.h:343:18: error: cannot bind non-const lvalue reference of type ‘AFP&’ to an rvalue of type ‘std::remove_reference<AFP&>::type {aka AFP}’
        *__result = std::move(*__first);
        ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from AFPchain.h:13:0,
                 from AFPchain.C:12:
AFP.h:103:8: note:   initializing argument 1 of ‘void AFP::operator=(AFP&)’
   void operator = (AFP &afp)
        ^~~~~~~~
make: *** [Makefile:27: AFPchain.o] Error 1

Could you please let me know how to fix this? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions