5557 – [64-Bit] FP (alignment?) issues with Rvalues

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5557 - [64-Bit] FP (alignment?) issues with Rvalues
Summary: [64-Bit] FP (alignment?) issues with Rvalues
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
Reported: 2011年02月10日 08:11 UTC by Martin Nowak
Modified: 2011年02月11日 01:25 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Martin Nowak 2011年02月10日 08:11:52 UTC
import std.stdio;
struct Temp {
 this(float ctorPar) {
 }
 this(double ctorPar) {
 }
 void buggy(float val) const {
 writeln(val);
 }
 void buggy2(double val) const {
 writeln(val);
 }
 void working(real val) const {
 writeln(val);
 }
}
void main() {
 Temp(7.f).buggy(2.); //!<- val == ctorPar
 Temp(7.f).buggy2(0.); //!<- val is some mixup of ctorPar
 Temp(7.f).working(2.);
 Temp(7.).buggy(2.); //!<- val == 0
 Temp(7.).buggy2(2.); //!<- val == ctorPar
 Temp(7.).working(2.);
}
------
Only the functions taking a real gets called with the correct parameter value.
The other two are influenced by the value to the ctor.


AltStyle によって変換されたページ (->オリジナル) /