cast(A)b is not an lvalue

2012-12-26 Thread Namespace
If I don't comment out line 19 I get: /home/c803/c821.d(19): Error: function c821.foo (ref A a) is not callable using argument types (B) /home/c803/c821.d(19): Error: cast(A)b is not an lvalue Code: http://dpaste.dzfl.pl/89f55c62 Should not work all three?

Re: cast(A)b is not an lvalue

2012-12-26 Thread Ali Çehreli
On 12/26/2012 07:37 AM, Namespace wrote: If I don't comment out line 19 I get: /home/c803/c821.d(19): Error: function c821.foo (ref A a) is not callable using argument types (B) /home/c803/c821.d(19): Error: cast(A)b is not an lvalue Code: http://dpaste.dzfl.pl/89f55c62 Should not work

Re: cast(A)b is not an lvalue

2012-12-26 Thread Namespace
I can answer the question in the subject line without looking at dpaste: Yes, in many cases the result of a cast operation is an rvalue. It is a temporary that is constructed at the spot for that cast operation. Imagine casting an int to a double. The four bytes of the int is nowhere close

Re: cast(A)b is not an lvalue

2012-12-26 Thread Ali Çehreli
On 12/26/2012 09:05 AM, Namespace wrote: I can answer the question in the subject line without looking at dpaste: Yes, in many cases the result of a cast operation is an rvalue. It is a temporary that is constructed at the spot for that cast operation. Imagine casting an int to a double. The

Re: cast(A)b is not an lvalue

2012-12-26 Thread monarch_dodra
On Wednesday, 26 December 2012 at 17:13:14 UTC, Ali Çehreli wrote: On 12/26/2012 09:05 AM, Namespace wrote: I can answer the question in the subject line without looking at dpaste: Yes, in many cases the result of a cast operation is an rvalue. It is a temporary that is constructed at the spot

Re: cast(A)b is not an lvalue

2012-12-26 Thread monarch_dodra
On Wednesday, 26 December 2012 at 19:45:53 UTC, monarch_dodra wrote: On Wednesday, 26 December 2012 at 17:13:14 UTC, Ali Çehreli wrote: On 12/26/2012 09:05 AM, Namespace wrote: I can answer the question in the subject line without looking at dpaste: Yes, in many cases the result of a cast

Re: cast(A)b is not an lvalue

2012-12-26 Thread Maxim Fomin
On Wednesday, 26 December 2012 at 17:13:14 UTC, Ali Çehreli wrote: Here is the code: import std.stdio; static if (!is(typeof(writeln))) alias writefln writeln; What does this for? I constantly face in code samples shared in this NG.

Re: cast(A)b is not an lvalue

2012-12-26 Thread Namespace
On Wednesday, 26 December 2012 at 19:52:21 UTC, Maxim Fomin wrote: On Wednesday, 26 December 2012 at 17:13:14 UTC, Ali Çehreli wrote: Here is the code: import std.stdio; static if (!is(typeof(writeln))) alias writefln writeln; What does this for? I constantly face in code samples

Re: cast(A)b is not an lvalue

2012-12-26 Thread Andrej Mitrovic
On 12/26/12, Maxim Fomin ma...@maxim-fomin.ru wrote: static if (!is(typeof(writeln))) alias writefln writeln; What does this for? I constantly face in code samples shared in this NG. Probably for D1 compatibility. D1 didn't have writeln.