On Sunday, 21 September 2014 at 18:24:53 UTC, Freddy wrote:
Is this supposed to happen?
---
import std.typecons;

alias feet=Typedef!(float,0.0,"feet");
alias meter=Typedef!(float,0.0,"meter");

void main(){
        feet a=4.0;
        meter b=5.0;
        meter c=a*b;//opps
        pragma(msg,typeof(c));
}
---
$dmd -o- typetest.d
Typedef!(float, 0.00000F, "meter")

nevermind the build-in typedef is worse
---
typedef float feet;
typedef float meter;
void main(){
        feet a=cast(feet)4.0;//these are required
        meter b=cast(meter)5.0;
        auto c=a*b;//opps
        pragma(msg,typeof(c));
}
---
$dmd type.d -o-
type.d(1): Deprecation: use of typedef is deprecated; use alias
instead
type.d(2): Deprecation: use of typedef is deprecated; use alias
instead
meter

Reply via email to