[Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 27 12:03:58 PST 2006


http://d.puremagic.com/issues/show_bug.cgi?id=614

           Summary: Real and imaginary properties of complex numbers not
                    allowed as template arguments
           Product: D
           Version: 0.175
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: sean at f4.ca


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


-- 




More information about the Digitalmars-d-bugs mailing list