Watch, Follow, &
Connect with Us
Public Report
Report From:    [ Add a report in this area ]  
Report #:  54836   Status: Open
Calcuations with TDateTime do not compile
Project:   Build #:  11.0.2804.9245
Version:    11.1 Submitted By:   Andreas Hausladen
Report Type:  Basic functionality failure Date Reported:  11/14/2007 10:57:09 AM
Severity:    Commonly encountered problem Last Updated: 11/14/2007 11:21:47 AM
Platform:    All platforms Internal Tracking #:  
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
The compiler cannot compile the following code:

var
  f, t: TDateTime;
begin
  t := Time;

  f := Trunc(t) - t; // fails in Delphi.NET
end;

Unit1.pas(30) Error: E2015 Operator not applicable to this operand type
Steps to Reproduce:
1. Open the attached Delphi.NET project
2. Compile the project

Expected:
The compiler finds no error

Actual:
The compiler fails with
Unit1.pas(30) Error: E2015 Operator not applicable to this operand type
Workarounds
Change the line
  f := Trunc(t) - t;
into
  f := Trunc(t) - Double(t);
Attachment
TDateTimeError.zip
Comments

None

Server Response from: ETNACODE01