If the name of a UFUNCTION parameter matches the name of a previously defined UPROPERTY variable, the project will fail compile due to the following reason:

Function parameter: '[Variable/Paramter Name]' conflicts with previously defined field in 'MyActor'

Defining the function before defining the variable allows the code to compile without error.

Steps to Reproduce
  1. Open UE4 Editor (any Project)
  2. Add two classes based on actor (MyActor and MyActor2)
  3. Add the following to MyActor.h
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
    	class AMyActor2* thisVar;
    	UFUNCTION(BlueprintCallable, Category = Test)
    		void AFunctionName(AMyActor2* thisVar);
  4. Add the following to MyActor.cpp
    void AMyActor::AFunctionName(AMyActor2* thisVar)
    	this->thisVar = thisVar;
  5. Compile

Compile fails with error message listed in description

Parameter name is independent of variable names

Repro Rate:

Have Comments or More Details?

Head over to the existing AnswerHub thread and let us know what's up.

Login to Vote

Won't Fix
ComponentUE - Foundation - Core
Affects Versions4.10.4
Target Fix4.12
CreatedFeb 29, 2016
ResolvedMar 22, 2016
UpdatedFeb 5, 2017