Browse Source

* make stringconstn => open array of char a l1 conversion as it was earlier, resolves #10727

git-svn-id: trunk@10984 -
florian 17 years ago
parent
commit
e265393d7a
4 changed files with 35 additions and 5 deletions
  1. 1 0
      .gitattributes
  2. 6 1
      compiler/defcmp.pas
  3. 2 4
      compiler/ncgutil.pas
  4. 26 0
      tests/webtbs/tw10727.pp

+ 1 - 0
.gitattributes

@@ -8158,6 +8158,7 @@ tests/webtbs/tw1066b.pp svneol=native#text/plain
 tests/webtbs/tw1068.pp svneol=native#text/plain
 tests/webtbs/tw10681.pp svneol=native#text/plain
 tests/webtbs/tw1071.pp svneol=native#text/plain
+tests/webtbs/tw10727.pp svneol=native#text/plain
 tests/webtbs/tw1073.pp svneol=native#text/plain
 tests/webtbs/tw10736.pp svneol=native#text/plain
 tests/webtbs/tw10753.pp svneol=native#text/plain

+ 6 - 1
compiler/defcmp.pas

@@ -717,7 +717,12 @@ implementation
                              { array -> open array }
                              if not(cdo_parameter in cdoptions) and
                                 equal_defs(tarraydef(def_from).elementdef,tarraydef(def_to).elementdef) then
-                               eq:=te_equal;
+                               begin
+                                 if fromtreetype=stringconstn then
+                                   eq:=te_convert_l1
+                                 else
+                                   eq:=te_equal;
+                               end;
                           end
                         else
                          { to array of const }

+ 2 - 4
compiler/ncgutil.pas

@@ -2780,8 +2780,8 @@ implementation
               LOC_CREFERENCE,
               LOC_REFERENCE:
                 begin
-                    reference_reset_base(href,cg.getaddressregister(list),objdef.vmt_offset);
-                    cg.a_load_loc_reg(list,OS_ADDR,selfloc,href.base);
+                  reference_reset_base(href,cg.getaddressregister(list),objdef.vmt_offset);
+                  cg.a_load_loc_reg(list,OS_ADDR,selfloc,href.base);
                 end;
               else
                 internalerror(200305057);
@@ -2838,5 +2838,3 @@ implementation
       end;
 
 end.
-
-

+ 26 - 0
tests/webtbs/tw10727.pp

@@ -0,0 +1,26 @@
+{$ifdef fpc} {$mode delphi}{$endif}
+Type
+   TStringBuilder = Class
+    function Insert(Index: Integer; const Value: string; Count: Integer = 1): TStringBuilder; overload;
+    function Insert(Index: Integer; const Value: array of Char): TStringBuilder; overload;
+end;
+
+function TStringBuilder.Insert(Index: Integer; const Value: array of Char): TStringBuilder;
+begin
+ writeln('Called TStringBuilder.Insert(Index: Integer; const Value: array of Char): TStringBuilder;');
+ result:=nil;
+end;
+
+function TStringBuilder.Insert(Index: Integer; const Value: string; Count: Integer): TStringBuilder;
+begin
+  writeln('Called TStringBuilder.Insert(Index: Integer; const Value: string; Count: Integer): TStringBuilder;');
+ result:=nil;
+end;
+
+var sb : TSTringBuilder;
+
+begin
+  sb:=TStringBuilder.Create;
+  sb.Insert(0, '0 ');
+  sb.Free;
+end.