Browse Source

* problem with temp ansistrings

peter 21 years ago
parent
commit
8b58545947
1 changed files with 23 additions and 0 deletions
  1. 23 0
      tests/tbs/tb0480.pp

+ 23 - 0
tests/tbs/tb0480.pp

@@ -0,0 +1,23 @@
+{$ifdef fpc}{$mode delphi}{$endif}
+
+procedure Test(const s1, s2: PAnsiChar);
+begin
+  Writeln(s1);
+  Writeln(s2);
+  if ansistring(s1)<>ansistring(s2) then
+    begin
+      writeln('Error');
+      halt(1);
+    end;
+end;
+
+var
+  S: AnsiString;
+  P: PAnsiChar;
+begin
+  S := 'Test';
+  P := PAnsiChar(S);
+  Test(PAnsiChar('String:'+S+';'), PAnsiChar('String:'+S+';'));
+  Test(PAnsiChar('String:'+P+';'), PAnsiChar('String:'+P+';'));
+end.
+