[dmd2.068] Bug or future?

VlasovRoman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 6 23:26:19 PDT 2015


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?


More information about the Digitalmars-d-learn mailing list