It looks like the GetValueAsName function, in Class.h on line 3393 is still referencing a function that was deleted in 5.8. Specifcally “StaticEnum”.
I’ve checked the 5.8 Release branch, and ue5_main and it seems to still be present there in both. Just wanted to flag it as it’s stopping us from compiling.
Many thanks,
David
EDIT:
Investigating further, I’m not sure if it’s a case of “deleted code wasn’t removed from all cases”, but perhaps I need to implement something to support the new way of doing things. I’m unfamiliar with C++'s Concepts feature, so I think I need to do some reading.
Is there any general advice for anyone called “GetValueAsName” with their own enums?
This would previously compile and sometimes link, depending on if a proper instantiation of StaticEnum<EMyEnum>() with the full type happens elsewhere. Now it always fails to compile.
The UE::CUEnum concept requires the existence of a StaticEnum<T>() implementation to determine if T is a UEnum rather than a regular enum, which you can’t tell from a simple forward declaration. By requiring the full type for both calling StaticEnum<T>() and using UE::CUEnum, we can detect this effectively.
I will put a comment on the function to guide users to the likely solution if they hit the same problem you did.
Thanks for the hint! Unfortunately it looks to be a little more complicated. The hash include for the enum in question is actually already present. However the enum in question isn’t an enum class.
Then again I may have a solution now after having typed that out. I’ll give it a shot.
But while I do that, my question in the meantime is: should that still compile? Is that still a valid way to do things following the change to StaticEnum?
Can you check your .generated.h file to see if it contains a StaticEnum<EMyEnumType::Enum>() declaration for your enum type? This should work whether it’s an enum class or regular enum.
Adding the size type seemed to kick the machine into gear. With it, I can see the StaticEnum in the generated header, without it, the function def isn’t generated.
Hello, I’m running into this same issue with UEnum::GetValueAsString
My Enum is typed and has the template in the generated code, but is still throwing the error.
// Project_Enums.h
UENUM(BlueprintType)
enum class EProject_ScreenResolution : uint8
{
_640x480,
};
I’m having the same problem. I’m trying to use UEnum::GetValueAsString and I also have that C2280 error because internally makes use of StaticEnum<Type>.
Have you found any workaround for this? Thanx in advance.