UE_LOGFMT error on 5.3

I have recently updated my project version to 5.3 and the experience has mostly been hassle-free, barring one error that appears in Rider when using UE_LOGFMT:

Cannot convert unsigned to parameter type int32: narrowing conversion

This occurs when using UE_LOGFMT in its most basic capacity and ensuring that Logging/StructuredLog.h is includeded like so:

UE_LOGFMT(LogTemp, Warning, "This is a warning message");

My project still compiles and runs perfectly but I’d like to fix these errors if possible. Has anyone encountered this error after upgrading to 5.3?

4 Likes

Just updated to 5.3 and have the same issue

1 Like

One of the lines the macro expands to, is along the lines of:

static constexpr ::UE::Logging::Private::FStaticLogRecord LOG_Static {
    L"some text", __builtin_FILE (), __builtin_LINE (), ::ELogVerbosity::Warning, LOG_Dynamic };

However, the __builtin_LINE () call returns an unsigned while the constructor expects an int. This is narrowing conversion, which might be warned against, but sometimes even error out in the syntax highlighter. In practice, there is nothing dangerous here.

This probably have to be fixed on the UE end, but I haven’t seen it yet happening.

2 Likes

As of Dec 2nd 2023, this isn’t fixed in ue-main branch yet as far as I can tell :frowning:

Fingers crossed it makes it in for 5.4 since this is quite annoying.

I guess I can roll my own UE_LOGFMT alternative for now :confused: