[dmd2.068] Bug or future?
Daniel Kozak via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Aug 7 00:00:18 PDT 2015
On Friday, 7 August 2015 at 06:26:21 UTC, VlasovRoman wrote:
> I have some code:
>
> import std.stdio;
>
> auto dot(T, R)(T x, R y) {
> return x * y;
> }
>
> struct Vector(T)
> {
> alias selftype = Vector!T;
> int len = 5;
> pure:
> const @property{
> static if( is( typeof( dot( selftype.init,
> selftype.init ) ) ) ){
> auto len2() {return len * len;}
> }
>
> static if(is(typeof(T.init * T.init) == T)) {
> auto e() {return len;}
> }
> }
> }
>
>
> void main() {
> Vector!(float) vec;
> float x = vec.len2();
> writeln(x);
> x = vec.e();
> writeln(x);
> }
>
> I get error by compiler when i build this:
> main.d(30): Error: no property 'len2' for type 'Vector!float',
> did you mean 'len'?
>
> In dmd 2.067 is normaly.
> is it Bug or enhancements?
Does not work in 2.067 for me.
Btw. you do not need to do this:
alias selftype = Vector!T;
You can just use Vector, or:
alias selftype = Vector;
if you prefer selftype as a name.
More information about the Digitalmars-d-learn
mailing list