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:\>