Description

A user has reported that Unreal Header Tool fails to parse a rep notify function properly when the optional parameter for the Old value is populated with a TWeakObjectPointer.

Example of errors:

Severity	Code	Description	Project	File	Line	Suppression State
Error	C2275	'TWeakObjectPtr<UObject,FWeakObjectPtr>': illegal use of this type as an expression	MyProject16	d:\unreal projects\main\myproject16\source\myproject16\MyActor.h	12	
Error	C2065	'Z_Param_OldSource': undeclared identifier	MyProject16	d:\unreal projects\main\myproject16\source\myproject16\MyActor.h	12	
Error	C3861	'P_GET_WEAKOBJECT': identifier not found	MyProject16	d:\unreal projects\main\myproject16\source\myproject16\MyActor.h	12	

Regression?: No
This occurred in 4.19

Steps to Reproduce
  1. Create a new C++ project
  2. Create a new C++ class based off of Actor
  3. In the .h file for the new class, add the following lines of code
     	UPROPERTY(Transient, ReplicatedUsing = "OnRep_Source")
    		TWeakObjectPtr<UObject> Source;
    
    	UFUNCTION()
    		void OnRep_Source(const TWeakObjectPtr<UObject> OldSource); 
  4. Compile the project
    Result: The compilation fails with multiple errors, due to the TWeakObjectPtr in the parameters for OnRep_Source
    Expected: The compilation succeeds

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-64947 in the post.

9
Login to Vote

Won't Fix
CreatedOct 8, 2018
ResolvedAug 18, 2021
UpdatedAug 18, 2021