How to align USTRUCT

How can I align a USTRUCT in memory?

USTRUCT(BlueprintType)
struct alignas(64) FSomeStruct {}

UHT freaks out with error : Struct 'alignas' is missing a valid Unreal prefix, expecting 'Falignas'
Regular structs work fine.

As a workaround I’m using dummy padding members e.g. uint32 Padding[8];

That clearly means UHT don’t recognize alignas, but this can also mean reflection system don’t support alignas all together as it need to track memory addresses so it needs to support it. Non-USTRUCT obviously work since UHT is not concerned about them and those don’t land to reflection system.

You might try reporting a bug:

You should get clear responce whatever there intention from Epic to support them, i got when i questioned UTF16 surrogates support (for characters above 0xFFFF) in Slate

I’ve reported it, fwiw it’s HeaderParser.cpp that won’t parse them.

Yea but it not only need to be parsed but also applied in reflection system in to UStruct class. The response will be send to your email

AFAIK this isn’t really a bug a USTRUCT is a class under the hood not a struct so its apples and oranges. Use an aligned native struct nested inside a USTRUCT should work.

Submitted a bug, got fixed, ETA 4.22 - nice!