There is no good compiler error for Server parameters passed by ref like in Beta

Dear Friends at Epic,

In the beta, if you attempted to pass a parameter by ref to a server function it would throw a very nice compile error like:

Cannot pass function parameters by reference in server functions

I just spent 20 min debugging the below

UFUNCTION(Reliable, Server, WithValidation)
	void JoyInit(FApexSpawnDestroyInfo In_DestroyVibes,bool DestroyImmediately=true);//const FApexSpawnDestroyInfo& In_DestroyVibes,bool DestroyImmediately=true);

because all the compiler says now

is that it cannot find the overloaded function.

Which really is not very helpful by comparison

any chance of improving this compiler error?

Thanks!

Rama

Hi Rama. Would you be able to provide the exact error message that you are seeing now?

Thanks!

Dear Tim,

It just says the overloaded function can’t be found, which is a very standard error, which is why its so confusing.

#Epic Please Address This

This error just got me again for awhile

“Overloaded function not found” is very non-specific!

#In beta it was great!

“Can’t pass parameters by reference in network functions” or something like that

#Escalation Requested

Tim, please escalate this to whomever can fix it.

Thanks!

Rama

PS: I’d give you the exact error, but its very standard, and my compile times are quite long now, its just the regular overloaded function can’t be found error

#Repro

It’s easy to reproduce, just add this parameter to any server function

const FName& MyNetVarPassedByReference

Rama

Hi Rama,

The error you talk about is still emitted, but it’s specifically for when you pass a non-const reference (e.g. I just added a FName& to AQAPawn::ServerEquipWeapon):

QAPawn.h(328): error : In QAPawn: Replicated FName parameters cannot be passed by non-const reference

The passing-by-const-reference shouldn’t be an error at all… this is a code generation bug. I’ll file a bug report for it.

Thanks!

Steve

"The passing-by-const-reference shouldn’t be an error at all… this is a code generation bug. I’ll file a bug report for it.

Thanks!

Steve"

You’re welcome Steve, great to hear from you!

#:heart:

Rama