Attempting to return a const pointer from a UFUNCTION will cause a VS compile error
The syntax
UFUNCTION(BlueprintCallable, Category = test)
const UMyActorComp* SomeFunc();
returns a VS compile error (@ GENERATED_BODY line) stating
Cannot convert from 'const UMyActorComp*' to 'UMyActorComp*'
This is likely related to [Link Removed]
UFUNCTION(BlueprintCallable, Category = test)
const UStaticMeshComponent* SomeFunc();
const UStaticMeshComponent* AMyActor::SomeFunc() { UStaticMeshComponent* Something; return Something; }
Result:
Compile fails with error mentioned in description
Expected:
Class compiles and UHT returns a const pointer
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-50745 in the post.
9 |
Component | UE - Foundation - Cpp Tools - UnrealHeaderTool |
---|---|
Affects Versions | 4.17.2, 4.18 |
Target Fix | 4.27 |
Fix Commit | 15018807 |
---|
Created | Oct 4, 2017 |
---|---|
Resolved | Jun 9, 2021 |
Updated | Jun 9, 2021 |
4081 - projectgheist |