x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

UHT failing to parse struct constructors

The following code works on 4.14 but does not work on 4,15

 USTRUCT(BlueprintType)
 struct FAry
 {
     GENERATED_USTRUCT_BODY()
         UPROPERTY()
         TArray<int32> cells;  
     FAry(){}
     friend FArchive& operator<<(FArchive& Ar, FAry& V)
     {
         return Ar << V.cells;
     }
 };
 USTRUCT(BlueprintType)
 struct F3DARY
 {
     GENERATED_USTRUCT_BODY()
     UPROPERTY()
         TArray<FAry> row;
     UPROPERTY()
         TArray<int32> faces;
     UPROPERTY()
         int32 numVerts;
     F3DARY()
     {
         numVerts = 0;
     }
     friend FArchive& operator<<(FArchive& Ar, F3DARY& V)
     {
         return Ar << V.row << V.faces << V.numVerts;
     }
 };
 USTRUCT(BlueprintType)
 struct F4DARY
 {
     GENERATED_USTRUCT_BODY()
     UPROPERTY()
         TArray<F3DARY> ROW;    //UP TO DOWN
     F4DARY()    {}
     friend FArchive& operator<<(FArchive& Ar, F4DARY& V)
     {
         return Ar << V.ROW;
     }
 };

In 4.15 the top struct works fine, but the second two structs fail. This thread on the forums is where someone helped me, thanks again to them for pointing out what was going on.

The thread

Product Version: UE 4.15
Tags:
more ▼

asked Apr 04 '17 at 03:54 AM in Bug Reports

avatar image

Thumper
961 139 149 387

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hi Thumper,

I apologize for the delay in responding to your post. Thank you for letting us know about this issue. Your suggestion about what was happening was close, but what is really happening here is most likely fallout from a change in 4.15 related to how struct names are parsed.

In this case, the problem is not really how your constructor is initializing properties, but instead that the name of the struct uses all capital letters. I discovered this quite by accident when I mistakenly named a struct in one of my test projects F3DAry instead of F3DARY, and the project built without any problems. I then tried including all three of your structs exactly as you provided them, but with the last two letters of the second and third structs lowercase, and the project built fine. It turns out that if any single letter in the struct's name is not capitalized, the build will complete successfully. I have entered UE-44950 to have this investigated further.

Tim

more ▼

answered May 11 '17 at 09:48 PM

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question