asBEHAVE_ASSIGN doesn't work with void return

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

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 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 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.

1. 1
2. 2
Rutin
20
3. 3
4. 4
frob
15
5. 5

• 9
• 9
• 13
• 9
• 33
• Forum Statistics

• Total Topics
632592
• Total Posts
3007284

×