Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > "illegal operand" error

Reply
Thread Tools

"illegal operand" error

 
 
Kostatus
Guest
Posts: n/a
 
      07-25-2003
The following code worked perfectly fine until i modified an unrelated part
of the program:
this->dungArea[x][y].mBlocked =
mioS.mio_dungArea[x][y].mFlags & isBlocked;

after that i started getting the error message:
error C2297: '&' : illegal, right operand has type 'bool (__thiscall
cDungeon::*)(int,int)'


Also,
if(this->dungArea[x][y].mBlocked)
mioS.mio_dungArea[x][y].mFlags |= isBlocked;

stopped working with the same kind of error message:
error C2297: '|=' : illegal, right operand has type 'bool (__thiscall
cDungeon::*)(int,int)'

Can anyone help me fix this?


 
Reply With Quote
 
 
 
 
John Carson
Guest
Posts: n/a
 
      07-25-2003
"Kostatus" <(E-Mail Removed)> wrote in message
news:bfqlv8$9a8$(E-Mail Removed)
> The following code worked perfectly fine until i modified an
> unrelated part of the program:
> this->dungArea[x][y].mBlocked =
> mioS.mio_dungArea[x][y].mFlags & isBlocked;
>
> after that i started getting the error message:
> error C2297: '&' : illegal, right operand has type 'bool
> (__thiscall cDungeon::*)(int,int)'
>
>
> Also,
> if(this->dungArea[x][y].mBlocked)
> mioS.mio_dungArea[x][y].mFlags |= isBlocked;
>
> stopped working with the same kind of error message:
> error C2297: '|=' : illegal, right operand has type 'bool
> (__thiscall cDungeon::*)(int,int)'
>
> Can anyone help me fix this?



Looks to me like isBlocked has been defined to be a pointer to a member
function of class cDungeon. Evidently, you can't use such pointers in
conjunction with the & operator.


 
Reply With Quote
 
 
 
 
Rolf Magnus
Guest
Posts: n/a
 
      07-25-2003
Kostatus wrote:

> The following code worked perfectly fine until i modified an unrelated
> part of the program:
> this->dungArea[x][y].mBlocked =
> mioS.mio_dungArea[x][y].mFlags & isBlocked;
>
> after that i started getting the error message:
> error C2297: '&' : illegal, right operand has type 'bool
> (__thiscall
> cDungeon::*)(int,int)'


Looks to me like isBlocked is not a variable, but a function, so the
compiler converts it into a pointer to it and gives it to the
operator&. Maybe you wanted to call the function instead? So you
probably wanted:

this->dungArea[x][y].mBlocked =
mioS.mio_dungArea[x][y].mFlags & isBlocked();

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xffc Thread 0x228 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-30-2006 03:16 PM
Error connecting to SQLExpress 2005 locally (error: 26 - Error Locating Server/Instance Specified) hfk0 ASP .Net 2 03-27-2006 08:43 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 1 03-24-2006 04:20 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-24-2006 02:22 PM
Error 500: ERROR: Cannot forward. Writer or Stream already obtained. Error JavaQueries Java 1 03-01-2005 06:30 PM



Advertisments