FString::Reverse inlined with definition in body

I’m not sure what’s the expected behaviour of FORCEINLINE across platforms. When I compile some code that uses FString::Reverse (which is FORCEINLINEed and has function body defined in the cpp file) in Windows, it compiles correctly.

Now on Mac with XCode, I’m getting an error about an inlined function with missing definition. I corrected the problem by moving the definition to the header.

Is it a bug?

From what I understand, FORCEINLINE on Windows is just a suggestion to the compiler, while on Mac, it’s actually forced and has to be done. Did you give the function a body? If not, that could be the issue. If you did define it, but in a separate file, try defining at the same time as declaring.

This is an actual error (I’m on 4.11.2) that should be fixed. I fixed it with this replacement in UnrealString.h:

	/**
	 * Returns a copy of this string, with the characters in reverse order
	 */
#if PLATFORM_MAC
    FORCEINLINE FString Reverse() const
    {
        FString New(*this);
        New.ReverseString();
        return New;
    }
#else
	FORCEINLINE FString Reverse() const;
#endif

But that should probably be fixed in possibly more than one location. I have to re-edit the file every time I have to do a validate / repair on Unreal (which seems to happen more than I think it should).