Bug 614 – Real and imaginary properties of complex numbers not allowed as template arguments

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
tools
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2006-11-27T14:03:00Z
Last change time
2015-06-09T01:36:17Z
Keywords
rejects-valid
Assigned to
thomas-dloop
Creator
sean

Comments

Comment #0 by sean — 2006-11-27T14:03:54Z
DMD generates an error if I use the '.re' or '.im' properties in a template call, but works if I extract this value into a constant and pass the constant to the template instead: C:\>type test.d version( A ) { template Eval( real x ) { const Eval = x; } template GetReal( creal x ) { const GetReal = Eval!( x.re ); } mixin GetReal!( 1.0 + 2.0i ); } version( B ) { template Eval( real x ) { const Eval = x; } template GetReal( creal x ) { const t = x.re; const GetReal = Eval!( t ); } mixin GetReal!( 1.0 + 2.0i ); } C:\>dmd -c test.d -version=A test.d(10): Error: no property 're' for type 'creal' test.d(10): variable test.GetReal!((1+2i)).GetReal voids have no value C:\>dmd -c test.d -version=B C:\>
Comment #1 by thomas-dloop — 2006-11-29T15:36:41Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] schrieb am 2006-11-27: > http://d.puremagic.com/issues/show_bug.cgi?id=614 > DMD generates an error if I use the '.re' or '.im' properties in a template > call, but works if I extract this value into a constant and pass the constant > to the template instead: <snip> Added to DStress as http://dstress.kuehne.cn/compile/c/cdouble_12_A.d http://dstress.kuehne.cn/compile/c/cdouble_12_B.d http://dstress.kuehne.cn/compile/c/cfloat_12_A.d http://dstress.kuehne.cn/compile/c/cfloat_12_B.d http://dstress.kuehne.cn/compile/c/creal_37_A.d http://dstress.kuehne.cn/compile/c/creal_37_B.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFbgMVLK5blCcjpWoRAutQAJ4tBTwtGy4ebndVZSCn5UZ1ehE8ogCgnNVH Vv8iSUmW/2aHFLii9dF/77w= =5LlM -----END PGP SIGNATURE-----
Comment #2 by davidl — 2008-06-25T01:20:33Z
dstress test cases get typos. This bug is already fixed. for partially typos related to this bug Index: compile/c/creal_37_B.d =================================================================== --- compile/c/creal_37_B.d (revision 1832) +++ compile/c/creal_37_B.d (working copy) @@ -19,7 +19,7 @@ template getImaginaryPart(creal x){ - const real getImanginaryPart = x.im; + const real getImaginaryPart = x.im; } static assert(getImaginaryPart!(a) == 2.0L); Index: compile/c/cfloat_12_B.d =================================================================== --- compile/c/cfloat_12_B.d (revision 1832) +++ compile/c/cfloat_12_B.d (working copy) @@ -19,7 +19,7 @@ template getImaginaryPart(cfloat x){ - const float getImanginaryPart = x.im; + const float getImaginaryPart = x.im; } static assert(getImaginaryPart!(a) == 2.0f); Index: compile/c/cdouble_12_B.d =================================================================== --- compile/c/cdouble_12_B.d (revision 1832) +++ compile/c/cdouble_12_B.d (working copy) @@ -19,7 +19,7 @@ template getImaginaryPart(cdouble x){ - const double getImanginaryPart = x.im; + const double getImaginaryPart = x.im; } static assert(getImaginaryPart!(a) == 2.0);
Comment #3 by braddr — 2008-06-25T01:45:28Z
Reopening and moving to the dstress component until dstress tests have been fixed.
Comment #4 by kamm-removethis — 2008-09-09T09:55:15Z
Fixed in dsource-dstress rev 1597