Compile with GNU c++
Closed this issue · 1 comments
hannes-ma commented
Hello,
is there a way to compile this header library with GNU c++?
I get lots of errors using cpp 9.3.0, standard C++11, especially regarding constexpr overloading:
MatrixUtil/MatrixUtil/vec_types.h:109:20: error: ‘constexpr float& mutil::Vector2::operator[](size_t) const’ cannot be overloaded with ‘constexpr const float& mutil::Vector2::operator[](size_t) const’
109 | constexpr float &operator[](size_t index)
| ^~~~~~~~
MatrixUtil/MatrixUtil/vec_types.h:104:26: note: previous declaration ‘constexpr const float& mutil::Vector2::operator[](size_t) const’
104 | constexpr const float &operator[](size_t index) const
| ^~~~~~~~
MatrixUtil/MatrixUtil/vec_types.h: In member function ‘constexpr float& mutil::Vector2::operator[](size_t) const’:
MatrixUtil/MatrixUtil/vec_types.h:111:20: error: binding reference of type ‘float&’ to ‘const float’ discards qualifiers
111 | return vec[index];
| ~~~~~~~~~^
MatrixUtil/MatrixUtil/vec_types.h:112:3: error: body of ‘constexpr’ function ‘constexpr float& mutil::Vector2::operator[](size_t) const’ not a return-statement
112 | }
| ^
evrhel commented
I originally meant for this library to be used with C++ 14. This issue is on C++ 11 for me as well. I updated the README to reflect this.