diff --git a/src/msw/datetimectrl.cpp b/src/msw/datetimectrl.cpp index 35ad786034..dffbee1802 100644 --- a/src/msw/datetimectrl.cpp +++ b/src/msw/datetimectrl.cpp @@ -121,10 +121,14 @@ void wxDateTimePickerCtrl::MSWUpdateFormat(bool valid) // as the control seems to remember whichever format was used when it was // created, i.e. this works both with and without wxDP_SHOWCENTURY. - // Note: due to a bug in MinGW headers, with missing parentheses around the - // macro argument (corrected in or before 8.2, but still existing in 5.3), - // we have to use a temporary variable here. - const TCHAR* const format = valid ? NULL : m_nullText.t_str(); + // Use a temporary variable to ensure that the code compiles in + // wxUSE_UNICODE_UTF8 case, where t_str() doesn't return a pointer. + const TCHAR* format; + if ( valid ) + format = NULL; + else + format = m_nullText.t_str(); + DateTime_SetFormat(GetHwnd(), format); }