delphi – 由于编译器错误,此代码是否无法构建?
发布时间:2020-12-15 04:26:11 所属栏目:大数据 来源:网络整理
导读:构建,而不仅仅是编译,如果使用Delphi 6,如果优化是打开的,以下内容会失败,内部编译错误.使用赋值而不是inc()工作.这是编译器的错误吗?奇怪的记录结构是因为原始代码已经减少到这个最小的例子. program Project1;type requestCountsType = array[0..1] of re
构建,而不仅仅是编译,如果使用Delphi 6,如果优化是打开的,以下内容会失败,内部编译错误.使用赋值而不是inc()工作.这是编译器的错误吗?奇怪的记录结构是因为原始代码已经减少到这个最小的例子.
program Project1; type requestCountsType = array[0..1] of record processed: int64; end; talliestype = record counts: requestCountsType; end; healthtype = record charged: talliestype; end; procedure computeProcessed(const h: healthtype; var requests,bytesin,bytesout: int64); var i: byte; begin requests := 0; bytesin := 0; bytesout := 0; for i := 0 to 1 do begin inc(requests,h.charged.counts[i].processed); // including this generates compiler internal error C1405 when optimization is on // requests := requests + h.charged.counts[i].processed; // this works end; end; var ht: healthtype; var r,b1,b2: int64; begin computeProcessed(ht,r,b2); end. 解决方法
见
bug report #109124.我可以在Delphi XE中确认问题;该bug报告说在Delphi XE4中已经修复了.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |