Description

UHT does not correctly create generated code for BlueprintNativeEvent UFUNCTIONs in an interface that return const values. In the corresponding .gen.cpp file, the generated code does not include the const keyword for the return type, resulting in a build failure due to different type modifiers on the function.

REGRESSION:
No.

Steps to Reproduce
  1. Create a new Basic Code project.
  2. Add a new code interface class to the project.
  3. Add the following function signature to the interface header file:
    public:
    	UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
    	const float TestMethod() const;
    
  4. Add the following function definition to the interface source file:
    const float IMyInterface::TestMethod_Implementation() const
    {
    	const float TestVar = 42.f;
    	return TestVar;
    }
    
    • Note that this definition is not necessary in version 4.20 and later.
  5. Build the project in Visual Studio.

RESULT:
The build will fail with the following error: error C2373: 'IMyInterface::TestMethod': redefinition; different type modifiers

EXPECTED:
The build completes successfully

Have Comments or More Details?

There's no existing public thread on this issue, so head over toAnswerHub just mention UE-62943 in the post.

2
Login to Vote

Fixed
ComponentCore
Affects Versions4.18.34.19.24.20.14.21
Target Fix4.22
Fix Commit4615192
CreatedAug 15, 2018
ResolvedNov 30, 2018
UpdatedNov 30, 2018
Pull Requests
4995 - GlassBeaver