Sign in to follow this  

asBEHAVE_ASSIGN doesn't work with void return

This topic is 3729 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The following code causes an error:
// ERROR! r = -10 (INVALID_DECLARATION)
r = engine->RegisterObjectBehaviour("Test", asBEHAVE_ASSIGNMENT, "void f(const Test &in)", asMETHOD(Test, operator=), asCALL_THISCALL);
// This works
//r = engine->RegisterObjectBehaviour("Test", asBEHAVE_ASSIGNMENT, "Test& f(const Test &in)", asMETHOD(Test, operator=), asCALL_THISCALL);

Is there any specific reason this is disallowed, or is this a bug?

Share this post


Link to post
Share on other sites
It's more for not opening up features before they have been thoroughly thought through, so that I won't have to remove them afterwards. Allowing other return types than the reference of the type, opens up more paths that need to be tested and I haven't had the time to analyse the true impacts of that yet.

Do you have any specific needs for not returning the reference of the object after an assignment?

Share this post


Link to post
Share on other sites
I don't have a particular reason for it. The reason I asked it is that for some reason TinyXML (which I'm trying to bind with my auto-binder) has it this way.

Since I'm generating wrapper functions anyway, it's easy to provide an AS compatible signature. I was just wondering why it was this way, no need to consider this a feature request :). It may be useful to mention it in the documentation, though.

Share this post


Link to post
Share on other sites
Sign in to follow this