Rubyko/RaptorQ

Error when compile in Ubuntu 14.04, g++ 4.8

Closed this issue · 1 comments

Hello, thank you for sharing your work. I am using your code and compile in Ubuntu 14.04, g++ 4.8. I modifed in cmake to work with older version of g++ as follows:

set(GCC_COVERAGE_COMPILE_FLAGS -std=c++1y -Ofast -Wall -pedantic)

Then I compile, it got error. I do not know how to fix it. I just post a part of error to here. Could you fix it? Thanks

/home/mjohn/Downloads/RaptorQ-master/include/octet.h:39:4: error: body of constexpr function ‘constexpr uint8_t func_ml::operator()(const uint8_t&, const uint8_t&) const’ not a return-statement
    }
    ^
/home/mjohn/Downloads/RaptorQ-master/include/octet.h: In member function ‘constexpr uint8_t func_dv::operator()(const uint8_t&, const uint8_t&) const’:
/home/mjohn/Downloads/RaptorQ-master/include/octet.h:47:5: warning: compound-statement in constexpr function [-Wpedantic]
     {
     ^
/home/mjohn/Downloads/RaptorQ-master/include/octet.h:53:4: error: body of constexpr function ‘constexpr uint8_t func_dv::operator()(const uint8_t&, const uint8_t&) const’ not a return-statement
    }
    ^
In file included from /home/mjohn/Downloads/RaptorQ-master/include/global.h:20:0,
                 from /home/mjohn/Downloads/RaptorQ-master/include/partition.h:28,
                 from /home/mjohn/Downloads/RaptorQ-master/include/source.h:20,
                 from /home/mjohn/Downloads/RaptorQ-master/include/rq.h:21,
                 from /home/mjohn/Downloads/RaptorQ-master/test/complete.cpp:17:
/home/mjohn/Downloads/RaptorQ-master/include/octet.h: In constructor ‘constexpr op2d<Func>::op2d(Func)’:
/home/mjohn/Downloads/RaptorQ-master/include/octet.h:84:4: error: constexpr constructor does not have empty body
    };
    ^
/home/mjohn/Downloads/RaptorQ-master/include/octet.h: In constructor ‘constexpr op1d<Func>::op1d(Func)’:
/home/mjohn/Downloads/RaptorQ-master/include/octet.h:102:4: error: constexpr constructor does not have empty body
    };
    ^
/home/mjohn/Downloads/RaptorQ-master/include/octet.h: At global scope:
/home/mjohn/Downloads/RaptorQ-master/include/octet.h:105:45: error: the type ‘const op2d<func_ml>’ of constexpr variable ‘ml’ is not literal
   const constexpr op2d<func_ml> ml{func_ml{}};
                                             ^
In file included from /home/mjohn/Downloads/RaptorQ-master/include/global.h:20:0,
                 from /home/mjohn/Downloads/RaptorQ-master/include/partition.h:28,
                 from /home/mjohn/Downloads/RaptorQ-master/include/source.h:20,
                 from /home/mjohn/Downloads/RaptorQ-master/include/rq.h:21,
                 from /home/mjohn/Downloads/RaptorQ-master/test/complete.cpp:17:
/home/mjohn/Downloads/RaptorQ-master/include/octet.h:74:10: note: ‘op2d<func_ml>’ is not literal because:
   struct op2d {  /* :TODO:2016年05月13日 02时09分24秒:: try to use templates to merge op1d and op2d to the one common class */

You must use C++14. Check the difference of "constexpr" in C++11 and C++14.