From 6ba102ee575ca97764117d05c580e30385438b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= Date: Fri, 21 Mar 2025 14:38:37 +0100 Subject: [PATCH] * Do not set strval for unicode strings in tc_emit_stringdef --- compiler/ngtcon.pas | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/ngtcon.pas b/compiler/ngtcon.pas index 809adceebe..83b48227c4 100644 --- a/compiler/ngtcon.pas +++ b/compiler/ngtcon.pas @@ -506,7 +506,11 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis (node.nodetype=stringconstn) then begin strlength:=tstringconstnode(node).len; - strval:=tstringconstnode(node).asconstpchar; + if (tstringconstnode(node).cst_type in [cst_unicodestring,cst_widestring]) then + { further on, tstringconstnode(node).valuews is used directly for this case } + strval:=nil + else + strval:=tstringconstnode(node).asconstpchar; { the def may have changed from e.g. RawByteString to AnsiString(CP_ACP) } if node.resultdef.typ=stringdef then