We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9386f96 commit 36ec77fCopy full SHA for 36ec77f
1 file changed
compiler/pstatmnt.pas
@@ -1903,8 +1903,11 @@ ((p.resultdef.typ=recorddef) or
1903
begin
1904
{ String literal constants get type array[0..n] of char
1905
(cst_conststring). Promote to the default string type
1906
- so that comparisons and assignments behave as expected. }
1907
- if is_conststring_array(hdef) then
+ so that comparisons and assignments behave as expected.
+ Single char literals are also promoted to string so
1908
+ that var s := 'x' behaves consistently with var s := 'xx'. }
1909
+ if is_conststring_array(hdef) or
1910
+ (not(nf_explicit in initexpr.flags) and is_char(hdef)) then
1911
1912
if m_default_unicodestring in current_settings.modeswitches then
1913
hdef := cunicodestringtype
0 commit comments