Description

UHT will fail during build in Visual Studio if a function tries to return a UEnum pointer. Adding a valid keyword before the return type will compile successfully.

Steps to Reproduce
  1. Create a new Basic Code project.
  2. Add a new UObject code class to the project.
  3. In the new code class, add a simple enum.
    • eg:
      UENUM(BlueprintType)
      enum class ETestEnum : uint8
      {
      	ONE,
      	TWO,
      	THREE,
      	FOUR,
      	FIVE
      };
      
  4. Add a function declaration and definition to the class that returns a UEnum pointer.
    • eg: UEnum* SomeFunc() const;
  5. Build the project in Visual Studio.

RESULT:
The build fails with the following error: error : 'Enum' is not allowed here

EXPECTED:
The build completes successfully.

WORKAROUND:
Add any valid keyword before the return type (eg. const UEnum* SomeFunc() const;) and the build will complete successfully.

Have Comments or More Details?

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

0
Login to Vote

Fixed
ComponentCore - UnrealHeaderTool
Affects Versions4.17.24.18.34.20
Target Fix4.20
Fix Commit3952504
Main Commit4034515
Release Commit4095966
CreatedMar 7, 2018
ResolvedMar 19, 2018
UpdatedMay 31, 2018