annotate compile/c/cfloat_12_B.d @ 1247:d75d907a68bb

[Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments Sean Kelly <sean@f4.ca> 2006-11-27 news:bug-614-3@http.d.puremagic.com/issues/
author thomask
date Wed, 29 Nov 2006 21:20:30 +0000
parents
children daef239f37cf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1247
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
1 // $HeadURL$
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
2 // $Date$
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
3 // $Author$
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
4
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
5 // @author@ Sean Kelly <sean@f4.ca>
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
6 // @date@ 2006-11-27
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
7 // @uri@ news:bug-614-3@http.d.puremagic.com/issues/
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
8 // @desc@ [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
9
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
10 module dstress.compile.c.cfloat_12_B;
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
11
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
12 const cfloat a = 1.0f + 2.0fi;
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
13
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
14 template getRealPart(cfloat x){
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
15 const float getRealPart = x.re;
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
16 }
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
17
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
18 static assert(getRealPart!(a) == 1.0f);
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
19
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
20
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
21 template getImaginaryPart(cfloat x){
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
22 const float getImanginaryPart = x.im;
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
23 }
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
24
d75d907a68bb [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments
thomask
parents:
diff changeset
25 static assert(getImaginaryPart!(a) == 2.0f);