I’m getting the invalid lvalue error using gcc 3.4.6. The line that invokes the error has a function that receives a pointer to SetElement (which is typedef void*). I’m trying to achieve this using casting from another type (also typedef void*) the following way: &((SetElement)my_var). gcc complains about this. Any idea what can be done?
Related Questions
No related questions found
You are taking the address of a temporary (an
rvalue), which cannot be done. This is like trying to do:You can create a temporary yourself (thus an
lvalue), using one of two methods:Or you can simply cast in a different way (solution):
This works because you’re taking the address of
my_var(anlvalue), and not of(SetElement)my_var(anrvalue).