Cannot perform operations with const vectors.

Bug #848758 reported by Alexandros Frantzis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libmatrix
Fix Released
Medium
Jesse Barker

Bug Description

When trying to perform operations using const vectors I get compile time errors. For example, I would expect this to work:

const LibMatrix::vec2 v(1.0, 1.0);
const LibMatrix::vec2 p(2.0, 2.0);

LibMatrix::vec2 vp(v + p);

but it gives the following error:

error: no match for ‘operator+’ in ‘v + p’
note: candidates are:
note: const LibMatrix::tvec2<T> LibMatrix::tvec2<T>::operator+(const T&) [with T = float, LibMatrix::tvec2<T> = LibMatrix::tvec2<float>]
note: no known conversion for argument 1 from ‘const vec2 {aka const LibMatrix::tvec2<float>}’ to ‘const float&’
note: const LibMatrix::tvec2<T> LibMatrix::tvec2<T>::operator+(const LibMatrix::tvec2<T>&) [with T = float, LibMatrix::tvec2<T> = LibMatrix::tvec2<float>] <near match>
note: no known conversion for implicit ‘this’ parameter from ‘const vec2* {aka const LibMatrix::tvec2<float>*}’ to ‘LibMatrix::tvec2<float>*

Similar errors occur for other operations involving const vectors and vectors or scalars.

Revision history for this message
Jesse Barker (jesse-barker) wrote :

Fixed at revision 24....

Changed in libmatrix:
status: New → Fix Released
assignee: nobody → Jesse Barker (jesse-barker)
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.