Advertisement
Guest User

Delphi XE4 Update1 compiler bug

a guest
Aug 30th, 2013
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.05 KB | None | 0 0
  1. (********
  2.  
  3.   Delphi XE4 Update1 compiler bug:
  4.       This program properly compiles and works in XE2 but not in XE4u1
  5.  
  6.   http://qc.embarcadero.com/wc/qcmain.aspx?d=118446
  7.  
  8. *******)
  9.  
  10. program qc118446;
  11. {$APPTYPE CONSOLE}
  12.  
  13. type
  14.     NestedTest<T> = record
  15.      type TestSetType = set of byte;
  16.      var  FTestSet: TestSetType;
  17.      function CalcRaisedBits1: integer;
  18.      function CalcRaisedBits2: integer;
  19.     end;
  20.    
  21.  function NestedTest<T>.CalcRaisedBits1: integer;
  22.  var
  23.     I: byte;
  24.  begin
  25.     Result := 0;
  26.     for I := Low(I) to High(I) do
  27.       if I in FTestSet then // [dcc32 Error]  E2015 Operator not applicable to this operand type
  28.         Inc(Result);
  29.  end;
  30.  
  31.  function NestedTest<T>.CalcRaisedBits2: integer;
  32.  var
  33.     I: byte;
  34.  begin
  35.     Result := 0;
  36.     for I in FTestSet do // [dcc32 Fatal Error]  F2084 Internal Error: E4260
  37.         Inc(Result);
  38.  end;
  39.  
  40.  
  41. var Rec: NestedTest<boolean>;
  42.  
  43. begin
  44.    Rec.FTestSet := [10, 20, 30, 40];
  45.    Writeln(4, ' == ', Rec.CalcRaisedBits1, ' == ', Rec.CalcRaisedBits2);
  46.    ReadLn;
  47. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement