Thread overview
[Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
Nov 27, 2006
d-bugmail
Nov 29, 2006
Thomas Kuehne
Jun 25, 2008
d-bugmail
Jun 25, 2008
d-bugmail
Jun 25, 2008
d-bugmail
Sep 09, 2008
d-bugmail
November 27, 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@digitalmars.com
        ReportedBy: sean@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:\>


-- 

November 29, 2006
d-bugmail@puremagic.com 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


June 25, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=614


davidl@126.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from davidl@126.com  2008-06-25 01:20 -------
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);


-- 

June 25, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=614


braddr@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
          Component|DMD                         |dstress
         Resolution|FIXED                       |




------- Comment #3 from braddr@puremagic.com  2008-06-25 01:45 -------
Reopening and moving to the dstress component until dstress tests have been fixed.


-- 

June 25, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=614


braddr@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|bugzilla@digitalmars.com    |thomas-dloop@kuehne.cn
             Status|REOPENED                    |NEW




-- 

September 09, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=614


kamm-removethis@incasoftware.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #4 from kamm-removethis@incasoftware.de  2008-09-09 09:55 -------
Fixed in dsource-dstress rev 1597


--